I encounter a strange Problem with Rails3 and send_data. A simple controller action should just send a small file to the browser:
def download
send_data "test", :filename => "file.txt", :type => 'text/plain'
end
When I click the link to that controller action in the browser nothing happens for almost exactly 120 seconds. After these 120 seconds the file will be downloaded instantly.
The strange thing is, that I can keep on browsing on the other sites of the web app and everything responds within milliseconds. The logfile shows
Rendered text template (0.0ms)
Sent data file.txt (0.8ms)
Completed 200 OK in 24ms (Views: 0.7ms | ActiveRecord: 1.3ms)
Just when i clicked the download link. Nothing is printed to the logfile after theses 120 seconds have passed and the file is actually send to the browser.
I am using Rails 3.0.7, POW and Mongrel on Mac OS X. Tested with Firefox and Chrome.
This was a POW-Problem. A workaround is to use Mongrel or Webrick.
See: github.com/37signals/pow/issues/102
Related
I am in the process of upgrading our app from Rails 3.2 to 4.2. One of the problems I've run into is that even static pages don't seem to be loading in the browser for some reason, despite browser activity. Example: I go to localhost:3000/pricing and get this in the server:
Started GET "/pricing" for 127.0.0.1 at 2015-01-16 15:44:59 -0500
Processing by PagesController#show as HTML
Parameters: {"id"=>"pricing"}
Rendered pages/pricing.html.haml within layouts/static (9.1ms)
Rendered layouts/_head.html.haml (64.4ms)
Rendered layouts/_navbar.html.haml (4.5ms)
Rendered layouts/_alerts.html.haml (1.0ms)
Rendered pages/_nav.html.haml (5.3ms)
Rendered shared/_social_links.html.haml (1.1ms)
Rendered layouts/_footer.html.haml (6.6ms)
Completed 200 OK in 130ms (Views: 123.8ms | ActiveRecord: 0.0ms)
However, the page in the browser itself is just white, the progress circle in the tab is spinning, and nothing is showing up.
Anyone know what might be causing this?
UPDATE
The page loads normally when I set config.cache_classes = true in development.rb. But this setting is normally false in development and wasn't doing this before I upgraded.
The problem was being caused by a gem called "rails-dev-tweaks" that is no longer needed in Rails 4. Removing that gem fixed the problem.
Your request on the server side seem to have completed in 130ms so this could be a problem with your client browser. Did you try using a different browser or look at the browser console of any javacript errors?
I have updated my Remine on servers from 2.3.0 to 2.4.1 and one (and only one of them) stops sending mail. If I was switched it back to 2.3.0 version, all works fine.
I am going to try to debug the code and just wondering which file in source code will be a good starting point to it ?
I have found notified_users(), recipients(), each_notification() in Issue model, but where is a code line which send email ?
Updated:
When I edit issue I get next message on console:
Rendered mailer/_issue.html.erb (2.2ms)
Rendered mailer/issue_edit.html.erb within layouts/mailer (4.8ms)
Sent email "[Redmine - ÐапÑÐ¾Ñ #13757] test" (26ms)
to: mymail#gmcs.ru
Date: Thu, 05 Dec 2013 17:34:07 +0400
....
cG9ydC5nbWNzLnJ1L215L2FjY291bnQ8L2E+PC9wPjwvc3Bhbj4KPC9ib2R5
Pgo8L2h0bWw+Cg==
----==_mimepart_52a080cfa4564_af93f8d53ef7714733eb--
Email delivery error: wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext)
(5.9ms) COMMIT
Redirected to http://vm-mecomstracker:90/issues/13757
Completed 302 Found in 574.3ms (ActiveRecord: 33.5ms)
I think you should look at app/models/mailer.
For example notified_users is used here
If update breaks sending emails I suggest to review config files, for example config/configuration.yml.example and check fresh issues on redmine.org
I'm having a problem with remote links in IE, and I need to get it up & running soon cause the deadline is today :S
The problem is that we're using AJAX to make a remote call to an action and eval the returned javascript.
When making the call using Firefox for example it's working fine, if I do it in IE, the response is made as HTML request.
IE entry in development log
Started GET "/semantic/country/5" for 127.0.0.1 at Wed Sep 07 12:06:00
+0200 2011 Processing by Semantic::SemanticController#country as HTML
Parameters: {"id"=>"5"} Country Load (1.0ms) SELECT countries.*
FROM countries WHERE countries.id = 5 LIMIT 1 Rendered
semantic/semantic/country.js.erb (1.0ms) Completed 200 OK in 1785ms
(Views: 54.0ms | ActiveRecord: 1.0ms)
Firefox call in development log
Started GET "/semantic/country/5" for 127.0.0.1 at Wed Sep 07 12:06:00
+0200 2011 Processing by Semantic::SemanticController#country as JS
Parameters: {"id"=>"5"} Country Load (1.0ms) SELECT countries.*
FROM countries WHERE countries.id = 5 LIMIT 1 Rendered
semantic/semantic/country.js.erb (1.0ms) Completed 200 OK in 1785ms
(Views: 54.0ms | ActiveRecord: 1.0ms)
The code used to generate the link is the following (in HAML):
link_to #vacancy.country.name, semantic_country_url(#vacancy.country.id), {:remote => true, :class => 'ajax'}
The problem seems to be how IE interprets the data-remote stuff in the HTML5. Is there a solution around this?
without switching to jquery, beause I cannot rewrite all the javascript in the application.
EDIT
Found out that the IE browser sends the request twice now,first time a JS, which works fine, but second time as HTML.
don't run firebug AND IEdevtools at the same time...They both respond to the feedback messages and start acting weird in this case.
Once I shut down Firebug IE worked fine.
I'm running a Rails 3.0.7 app with nginx and Passenger. I have a custom 500 page that is properly displayed when the app encounters an 500 internal error, however the actual '500' status is not being output to the logs.
I'd like to be able to periodically grep the logs to find 500 errors, but I can't seem to figure out why the actual status is not being rendered. I've even looked through the Rails code, and everything looks fine. All other status codes are successfully logged.
Here is an error-free 200 response:
Completed 200 OK in 1265ms (Views: 1262.4ms | ActiveRecord: 69.6ms | Sphinx: 0.0ms)
Here is a 500 response:
Completed in 500ms
It appears that something is supposed to be there, but is not, so spaces are output instead.
Looks like this has been resolved in Rails master, but is not in the gem for 3.0.7 yet.
https://github.com/rails/rails/commit/7927fc2ff77543a0ab151ac1cb3d60318e2dfa68
I tried out rails 3, and just started a new project. The following is all I typed.
rails new todo
cd todo
bundle install
rails generate scaffold Task done:boolean task:text created:date
rake db:migrate
rails server&
firefox 0.0.0:3000/tasks&
On page 0.0.0:3000/tasks/new, I filled in some values for the fields, and clicked the button to create a new task. It redirects to 0.0.0:3000/tasks with a blank page. When I manually reload the page, it shows up eight tasks even though there is supposed to be only one.
When I further click either show, edit, or destroy, it says, for e.g.: ActiveRecord::RecordNotFound in TasksController#show Couldn't find Task with ID=1.
When I reload to 0.0.0:3000/tasks, all eight tasks are still there.
What is wrong with this? Is rails corrupted on my computer?
Log
When I click 'create tasks', the terminal displays
Started GET "/tasks/new" for 127.0.0.1
at 2011-05-13 22:04:26 -0400
Processing by TasksController#new as
HTML Rendered tasks/_form.html.erb
(6.7ms) Rendered tasks/new.html.erb
within layouts/application (25.3ms)
Completed 200 OK in 35ms (Views:
27.9ms | ActiveRecord: 0.0ms)
folowed by something like this repeated eight times with x in tasks/x varying from 1 to 8:
Started POST "/tasks" for 127.0.0.1 at
2011-05-13 22:04:32 -0400 Processing
by TasksController#create as HTML
Parameters: {"utf8"=>"✓",
"authenticity_token"=>"QZHWWyE5KcZhLrzRhB4Fgnl9HGiQqNkn17O4CUfUUJU=",
"task"=>{"done"=>"0",
"task"=>"test\r\n",
"created(1i)"=>"2011",
"created(2i)"=>"5",
"created(3i)"=>"14"},
"commit"=>"Create Task"} AREL
(0.2ms) INSERT INTO "tasks" ("done",
"task", "created", "created_at",
"updated_at") VALUES ('f', 'test ',
'2011-05-14', '2011-05-14
02:04:32.065805', '2011-05-14
02:04:32.065805') Redirected to
http://0.0.0:3000/tasks/2 Completed
302 Found in 17ms [2011-05-13
22:04:32] ERROR URI::InvalidURIError:
the scheme http does not accept
registry part: 0.0.0:3000 (or bad
hostname?)
/usr/local/lib/ruby/1.9.1/uri/generic.rb:746:in
rescue in merge'
/usr/local/lib/ruby/1.9.1/uri/generic.rb:743:in
merge'
/usr/local/lib/ruby/1.9.1/webrick/httpresponse.rb:163:in
setup_header'
/usr/local/lib/ruby/1.9.1/webrick/httpresponse.rb:101:in
send_response'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:86:in
run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in
block in start_thread'
You're trying to access your site using 0.0.0:3000 which is an invalid address (I'm actually surprised this even gives you access to the site at all).
Open 0.0.0.0:3000 in Firefox instead, and it will work perfectly!
(You can also use localhost:3000 or 127.0.0.1:3000)
Task is a reserved word in Rails. I guess thats the reason why rails is behaving in a starnge way.
For a list of other reserved words please refer to any of these links
http://cheat.errtheblog.com/s/rails_reserved_words/
http://www.yup.com/articles/2007/01/31/no-reservations-about-keywords-in-ruby-on-rails
http://oldwiki.rubyonrails.org/rails/pages/ReservedWords