naidu / redmine-dmsf

Automatically exported from code.google.com/p/redmine-dmsf
0 stars 0 forks source link

undefined method `size' #191

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

  I have this erreor when I click on DMSF link from a project :

ActionView::TemplateError (undefined method `size' for nil:NilClass) on
line #64 of vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:
61:                   :class => "icon icon-folder") %>
62:                 <div class="filename" title="<%=
l(:title_number_of_files_in_directory)%>">[<%= subfolder.deep_file_count
%>]</div>
63:             </td>
64:             <td class="size" title="<%=
l(:title_total_size_of_all_files)%>"><%=
number_to_human_size(subfolder.deep_size) %></td>
65:             <td class="modified"><%=
subfolder.updated_at.strftime("%Y-%m-%d %H:%M") %></td>
66:             <td class="version"></td>
67:             <td class="author"><%= h(subfolder.user) %></td>

    vendor/plugins/redmine_dmsf/app/models/dmsf_file.rb:139:in `size'
    vendor/plugins/redmine_dmsf/app/models/dmsf_folder.rb:132:in `deep_size'
    vendor/plugins/redmine_dmsf/app/models/dmsf_folder.rb:132:in `deep_size'
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:64
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:55:in `each'
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:55
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:27
    /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:96:in
`process_request'

/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:513:in
`accept_and_process_next_request'

/usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:274:in
`main_loop'

/usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:321:in
`start_request_handler'

/usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:in
`send'

/usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:275:in
`handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/utils.rb:479:in `safe_fork'

/usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:270:in
`handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:in
`server_main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:206:in
`start_synchronously'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:180:in `start'

/usr/lib/ruby/1.8/phusion_passenger/classic_rails/application_spawner.rb:149:in
`start'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:219:in
`spawn_rails_application'

/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:132:in
`lookup_or_add'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:214:in
`spawn_rails_application'

/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:82:in
`synchronize'

/usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in
`synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:213:in
`spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:132:in
`spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:275:in
`handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:357:in
`server_main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:206:in
`start_synchronously'
    /usr/share/phusion-passenger/helper-scripts/passenger-spawn-server:99

Redmine version 1.3.1
DMSF version : 1.2.2

Thanks for your help

Guidtz

Original issue reported on code.google.com by guillaum...@gmail.com on 2 Feb 2012 at 1:21

GoogleCodeExporter commented 9 years ago
Same problem running on a mongrel cluster:

Processing DmsfController#show (for 10.74.119.28 at 2012-03-14 14:57:24) [GET]
  Parameters: {"id"=>"pd1113", "controller"=>"dmsf", "action"=>"show"}
Rendering template within layouts/base
Rendering dmsf/show

ActionView::TemplateError (undefined method `size' for nil:NilClass) on line 
#64 of vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:
61:                       :class => "icon icon-folder") %>
62:                             <div class="filename" title="<%= 
l(:title_number_of_files_in_directory)%>">[<%= subfolder.deep_file_count 
%>]</div>
63:                     </td>
64:                     <td class="size" title="<%= 
l(:title_total_size_of_all_files)%>"><%= 
number_to_human_size(subfolder.deep_size) %></td>
65:                     <td class="modified"><%= 
subfolder.updated_at.strftime("%Y-%m-%d %H:%M") %></td>
66:                     <td class="version"></td>
67:                     <td class="author"><%= h(subfolder.user) %></td>

    vendor/plugins/redmine_dmsf/app/models/dmsf_file.rb:147:in `size'
    vendor/plugins/redmine_dmsf/app/models/dmsf_folder.rb:120:in `deep_size'
    vendor/plugins/redmine_dmsf/app/models/dmsf_folder.rb:120:in `deep_size'
    vendor/plugins/redmine_dmsf/app/models/dmsf_folder.rb:121:in `deep_size'
    vendor/plugins/redmine_dmsf/app/models/dmsf_folder.rb:121:in `deep_size'
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:64
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:55:in `each'
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:55
    vendor/plugins/redmine_dmsf/app/views/dmsf/show.html.erb:27
    config/initializers/mongrel.rb:62:in `dispatch_cgi'

Rendering /usr/prdev/redmine/public/500.html (500 Internal Server Error)

Original comment by smip...@gmail.com on 14 Mar 2012 at 2:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Additional notes:

Only some Redmine projects are affected (pd1113 project example above).

Other projects on the same server may be unaffected.  E.g:

Processing DmsfController#show (for 10.74.119.28 at 2012-03-14 15:37:44) [GET]
  Parameters: {"action"=>"show", "id"=>"pd1114", "controller"=>"dmsf"}
Rendering template within layouts/base
Rendering dmsf/show
Completed in 443ms (View: 389, DB: 1) | 200 OK 
[http://prdev.eu.omron.net/redmine/dmsf/pd1114]

Original comment by smip...@gmail.com on 14 Mar 2012 at 2:40

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I identified what causes DMSF rendering to fail, but a root-cause is still 
eluding me:
1. Some as yet unidentified bug resulted in DMSF adding a file entry in 
Redmine's SQL database for which no file revisions were created (the dmsf_files 
table contains a record without any associated record(s) in the 
dmsf_file_revisions table).
2. When the DmsfController#show method renders the folder, it attempts to 
display the total size of all files contained in the folder and it's 
sub-folders.
3. The file for which there is no revision data available cannot be 
class-resolved, resulting in the observed error.

Workarounds (to get DMSF rendering again):
1. Identify any records in the table dmsf_files for which there are no 
dmsf_file_revisions (I.e. For some dmsf_file, you can find no 
dmsf_file_revisions where dmsf_files.id = dmsf_file_revisions.dmsf_file_id).  
You can use any tool that gives you access to the Redmine database (I used 
phpmyadmin).
2. Delete these records.

Original comment by smip...@gmail.com on 14 Mar 2012 at 5:05

GoogleCodeExporter commented 9 years ago
This bug happens altogether too often!  It seems to happen on some browsers 
when the file upload / creation is interrupted.  There is no way to recover 
from this other than manually messing about in the Redmine SQL database.

Original comment by smip...@gmail.com on 26 Mar 2012 at 4:37

GoogleCodeExporter commented 9 years ago
Here is a workaround that should allow you to recover from this bug:

To identify any files missing revisions:

  SELECT * FROM `dmsf_files`
  WHERE NOT EXISTS(
    SELECT * FROM `dmsf_file_revisions`
    WHERE `dmsf_file_revisions`.`dmsf_file_id` = `dmsf_files`.`id`
  )

And delete the files missing revisions to recover from the problem:

  DELETE FROM `dmsf_files`
  WHERE NOT EXISTS(
    SELECT * FROM `dmsf_file_revisions`
    WHERE `dmsf_file_revisions`.`dmsf_file_id` = `dmsf_files`.`id`
  )

Original comment by smip...@gmail.com on 16 Apr 2012 at 1:25

GoogleCodeExporter commented 9 years ago
Thanks for you workaround, it worked perfectly for me. Hope this bug will be 
resolved.

Original comment by serge.d...@gmail.com on 25 Sep 2012 at 9:14

GoogleCodeExporter commented 9 years ago
According to:
"1. Some as yet unidentified bug resulted in DMSF adding a file entry in 
Redmine's SQL database for which no file revisions were created (the dmsf_files 
table contains a record without any associated record(s) in the 
dmsf_file_revisions table)."

I was able to identify one scenario which causes creation of such un-revisioned 
file:
1. Add file (version 1.0)
2. Add another revision (version 1.1)
3. From the details view, remove version 1.0 => works OK
4. Then remove version 1.1 => after reload: "Internal error" (caused by 
described database mismatch)

Trying remove version 1.0, after the step 1. user receives message that it is 
prohibited because the file can not exist with no revisions. It seems this 
message is missing in the case described above. It is possible that the problem 
could be solved by just improving validation of "remove" action in the detail 
view.

Original comment by witold.s...@gmail.com on 11 Oct 2012 at 3:23

GoogleCodeExporter commented 9 years ago
I created this issue on github where the plugin is still developped.
I think u should post this there : 
https://github.com/danmunn/redmine_dmsf/issues/52

Thanks 

Original comment by serge.d...@gmail.com on 11 Oct 2012 at 3:43