iconara / bigshift

A tool for moving tables from Redshift to BigQuery
BSD 3-Clause "New" or "Revised" License
65 stars 10 forks source link

for_fd': Bad file descriptor - not a socket file descriptor (Errno::EBADF) #23

Open satygupta opened 5 years ago

satygupta commented 5 years ago

Hi,

I am getting the same error. I have installed 0.4.0 version on windows 7.

I have Ruby+Devkit 2.5.3-1 (x64) installed and pg-1.1.4-x64-mingw32

the error is

D, [2019-02-13T14:52:26.826793 #11316] DEBUG -- : Setup complete
D, [2019-02-13T14:52:26.827793 #11316] DEBUG -- : Running unload
Traceback (most recent call last):
7: from C:/Ruby25-x64/bin/bigshift:23:in `<main>' 6: from C:/Ruby25-x64/bin/bigshift:23:in `load'
5: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bigshift-0.4.0/bin/bigshift:6:in `<top (required)>' 4: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bigshift-0.4.0/lib/bigshift/cli.rb:30:in `run'
3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bigshift-0.4.0/lib/bigshift/cli.rb:59:in `unload' 2: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bigshift-0.4.0/lib/bigshift/cli.rb:194:in `redshift_unloader'
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bigshift-0.4.0/lib/bigshift/cli.rb:239:in `create_rs_connection' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bigshift-0.4.0/lib/bigshift/cli.rb:239:in `for_fd': Bad file descriptor - not a socket file descriptor (Errno::EBADF)

When I use interactive ruby for checking for the line socket = Socket.for_fd(rs_connection.socket)

I get the same error. Also when I try to get the socket by rs_connection.socket, I get the value (#).

So the connection is still active. I tried rs_connection.exec( "select count(*) as datname from xxx.xxx;" ).to_a.first and I get he result.

I unistalled ruby 2.5.3-1 and installed ruby 2.6.0-1, Still getting the same error.

Please help.

Regards, sat

iconara commented 5 years ago

All I can say is that it's probably a Windows thing, sockets work differently. I unfortunately have no possibility to debug the issue.