ECONNRESET error when accessing Ruby application which runs in Webrick - ruby

I am trying to install redmine (bugtracker which runs on ruby). I use webrick, it starts all fine, but when I access http://IP:3000/, it throws the following error in the server logs and the page does not load in the browser.
ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:11
/root/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:82:in `eof?'
/root/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:82:in `run'
/root/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'
I am a bit stuck here, any help would be greatly appreciated.
Thanks in advance.

In the end, it was due to the port 3000 was being blocked by the network where the server was part of. Once the port block was removed, it started to work. Thanks #mike-k for your tips.

Related

Error accessing localhost:port through bash on ubuntu on windows

I'm trying to access connection to a database through aptible and when I try to do that , I get an error that seems to be related to permission/access .
Creating tunnel...r
/opt/aptible-toolbelt/embedded/lib/ruby/gems/2.2.0/gems/aptible-cli-0.7.3/lib/aptible/cli/helpers/tunnel.rb:53\
:in `rescue in start': Tunnel did not come up, is something else listening on port 60387? (RuntimeError)
bind: Address already in use
(8ミ | INFO: Connecting to database...
(8ミ | ERROR: 403 (access_denied)
I tried editing the file to use different ports but the same error persists .
It seems to be erroring out in connecting to localhost:portnumber .
Could someone help me here ?
This is very important for me as I'm working on a important project .
Thanks
Nanditha
It looks like a bug that looked like this was fixed at one point:
https://github.com/aptible/aptible-cli/issues/47
Try a newer version of aptible?

Calabash always logging Errno::ECONNREFUSED

I am trying to run a calabash script on iOS but continually getting the following errors:
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (http://localhost:37265))
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (http://localhost:37265))
Failing... Errno::ECONNREFUSED
Given I am on the homepage # features/step_definitions/homepage_steps.rb:6
Connection refused - connect(2) (http://localhost:37265) (Errno::ECONNREFUSED)
./features/PageObjects/home_page.rb:12:in `initialize'
./features/step_definitions/homepage_steps.rb:7:in `new'
./features/step_definitions/homepage_steps.rb:7:in `/^I am on the homepage$/'
features/general.feature:9:in `Given I am on the homepage'
Anyone have any suggestions on fixing this error?
I don't know if you are running on iOS or Android.
Running on Android, this can be caused by the device disconnecting from USB (unstable USB connection), or becoming invisible to ADB in some other way.
In this instance I fixed this by commenting ount 'APP_BUNDLE_PATH' within 01_launch.rb file. All working now.
So looks like the path to the APP_BUNDLE_PATH was set incorrectly. Hopefully this answer might help others.

Anyone get working FTPS/FTP::TLS Under Ruby 1.9.3?

I've tried several gems, examples, etc, and cannot get this working, the more promising gems were: double-bag-ftps and FTPFXP, I can connect but I cannot transfer files, in active or passive mode..
sample code with ftpfxp:
#conn2 = Net::FTPFXPTLS.new
#conn2.passive = true
#conn2.debug_mode = true
#conn2.connect('192.168.0.2', 990)
#conn2.login('myuser2', 'mypass2')
#conn2.chdir('/')
#conn2.get("data.txt")
#conn2.close
sample code with double-bag:
ftps = DoubleBagFTPS.new
ftps.ssl_context = DoubleBagFTPS.create_ssl_context(:verify_mode => OpenSSL::SSL::VERIFY_NONE)
ftps.connect('192.168.0.2')
ftps.login('myuser2', 'mypass2')
ftps.chdir('/')
ftps.get("data.txt")
ftps.close
sample error with double-bag:
~/.rbenv/versions/1.9.3-p385/lib/ruby/gems/1.9.1/gems/double-bag-ftps-0.1.0/lib/double_bag_ftps.rb:148:in `connect': Broken pipe - SSL_connect (Errno::EPIPE)
Sample error with ftpfxp:
~/.rbenv/versions/1.9.3-p385/lib/ruby/1.9.1/net/ftp.rb:206:in `initialize': No route to host - connect(2) (Errno::EHOSTUNREACH)
Any recomendation that does not involve external commands ?
Thanks.
I've solved the issue, the server was returning a private ip address while trying to connect in pasive mode with Explicit tls, so I've added a line to Double-Bag-FTPS to check if the returned ip was private fallback to the original public ip address...
GitHub Pull request
So if someone has the same issue maybe this is the answer hope that this can help someone else :)

Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner

I'm using sinatra for my app, i replicated the exact copy from devserver1 to devserver2, but only on devserver1 is working.
I got this on my devserver2 apache error.log :
Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (undefined method `<<' for nil:NilClass (NoMethodError)) (process 5516, thread #):
Any help is much appreciated.
FYI: I'm using rvm and ruby-1.9.2
Found out the bug. The app is accessing a remote service which has a HTTP Authentication, it cannot pass thru that so it timed-out. Now my next problem is how to make the app bypass that HTTP authentication.

Ruby networking problem on windows

I am running windows XP with ruby 1.8.6 patchlevel 111. I am using HTTP to connect to a remote server and it has been running fine. All of a sudden it started to through the exception listed below (I did not change any code since the last time I ran it successfully). Does anybody know what is going on?
c:/ruby/lib/ruby/1.8/timeout.rb:54:in `rbuf_fill': execution expired (Timeout::E
rror)
from c:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'
from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
from c:/ruby/lib/ruby/1.8/net/protocol.rb:126:in `readline'
from c:/ruby/lib/ruby/1.8/net/http.rb:2029:in `read_status_line'
from c:/ruby/lib/ruby/1.8/net/http.rb:2018:in `read_new'
from c:/ruby/lib/ruby/1.8/net/http.rb:1059:in `request'
... 19 levels...
from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
from c:/ruby/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
from c:/ruby/lib/ruby/1.8/test/unit.rb:278
from c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader
.rb:5
rake aborted!
Command failed with status (3): [c:/ruby/bin/ruby -Ilib;test "c:/ruby/lib/r...]
Maybe the remote host is down? Or a new firewall has been put between your machine and the remote host?
"Timeout::Error" usually points to that direction.
besides the obvious (firewall, you got blacklisted for bad user-agent or ignoring robots.txt), you can try curl
http://curl.haxx.se/libcurl/ruby/
OR increase net/http timeout to say, 30+ seconds
http://groups.google.com/group/rubyonrails-talk/msg/cc89e8ae6703d6fb
It could be related to this known Ruby bug where Timeout::Error does not subclass Exception. (fixed in 1.9.2 I believe)
http://lindsaar.net/2007/12/9/rbuf_filltimeout-error
It can be fixed by rescuing from Timeout::Error like rescue Timeout::Error => e

Resources