Hi all, I get a (usually) reproducible error for only one of my controllers. This doesn''t happen for any of the other 10+ controllers. I didn''t see anything weird about file permissions. The "offending" line 142 is quite innocuous and triggers the error even when that portion of the controller is not even being run. . . . 141 while logfile.readline 142 next unless /Average Redundancy Per Shell/ 143 break 144 end . . . The error looks like this in the logs/development.log file. I''ve edited it slightly to allow for posting. Processing Base#index (for 127.0.0.1 at Thu Nov 03 15:43:02 Eastern... Parameters: {} Errno::EBADF (Bad file descriptor): /app/controllers/datasets_controller.rb:142:in `write'' Rendering C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/ (cont.) lib/action_controller/templates/rescues/layout.rhtml (cont.) (500 Internal Error) I''m running Rails 0.13.1 + Webrick 1.3.1 in development mode on a WinXP box. Thanks in advance for your insight. -cal
Anyone? Anyone? Bueller? Seriously, I can''t believe that I''m the only person who has seen this error. -cal
Have you tried rewriting these lines of code without using ruby "shortcuts"? while str = logfile.readline next unless str =~ /Average Redundancy Per Shell/ break end cal wrote:> Hi all, > > I get a (usually) reproducible error for only one of my controllers. This > doesn''t happen for any of the other 10+ controllers. I didn''t see anything > weird about file permissions. The "offending" line 142 is quite innocuous > and triggers the error even when that portion of the controller is not even > being run. > > . > . > . > 141 while logfile.readline > 142 next unless /Average Redundancy Per Shell/ > 143 break > 144 end > . > . > . > > The error looks like this in the logs/development.log file. I''ve edited > it slightly to allow for posting. > > Processing Base#index (for 127.0.0.1 at Thu Nov 03 15:43:02 Eastern... > Parameters: {} > Errno::EBADF (Bad file descriptor): > /app/controllers/datasets_controller.rb:142:in `write'' > Rendering C:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.9.1/ (cont.) > lib/action_controller/templates/rescues/layout.rhtml (cont.) > (500 Internal Error) > > I''m running Rails 0.13.1 + Webrick 1.3.1 in development mode on a WinXP box. > > Thanks in advance for your insight. > > -cal > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Saltman <saltman@...> writes:> Have you tried rewriting these lines of code without using ruby "shortcuts"? > > while str = logfile.readline > next unless str =~ /Average Redundancy Per Shell/ > break > endYou''re the man, Saltman! I made your suggested change and it seems to be working. Thanks a bunch. I wonder if this is a ruby on windows-only issue? -cal