New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendWakeup: invalid argument (Bad file descriptor) #566

Closed
nerfpops opened this Issue Apr 18, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@nerfpops

nerfpops commented Apr 18, 2016

Had to restart PostgREST because of this error:

postgrest: c_poll: permission denied (Operation not permitted)
postgrest: sendWakeup: invalid argument (Bad file descriptor)
172.19.0.1 - - [18/Apr/2016:11:11:23 +0000] "GET / HTTP/1.1" 200 - "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
Control.AutoUpdate.mkAutoUpdate: worker thread exited with exception: sendWakeup: invalid argument (Bad file descriptor)
Control.AutoUpdate.mkAutoUpdate: worker thread exited with exception: sendWakeup: invalid argument (Bad file descriptor)
Control.AutoUpdate.mkAutoUpdate: worker thread exited with exception: sendWakeup: invalid argument (Bad file descriptor)

I'm using Docker (begriffs/postgrest)

@begriffs

This comment has been minimized.

Member

begriffs commented Apr 18, 2016

Looks like issue #557 turned out to be more of a problem then we thought. I'm going to close that other issue because this one has more details.

Approximately how long was postgrest running before this happened?

@begriffs begriffs added the bug label Apr 18, 2016

@nerfpops

This comment has been minimized.

nerfpops commented Apr 18, 2016

Hard to say. I start and stop PostgREST all the time. Less than ½ hour and more than 5 minutes I guess. Haven't experienced this issue before though, but will keep you posted if I see it again.

@nerfpops

This comment has been minimized.

nerfpops commented Apr 18, 2016

Perhaps timestamps in the log would make things easier?

@begriffs

This comment has been minimized.

Member

begriffs commented Apr 18, 2016

Possible causes

  • A revival of this ghc bug
  • Incompatibility of the binary I built in Ubuntu with the debian:jessie Docker image
  • Docker file handling incompatible with Control.AutoUpdate

Debugging suggestion

Make a custom Docker image that builds off begriffs/postgrest and adds an strace:

strace -ff -e trace=file -p <postgrest-pid>

This will show us the files it is trying to access.

@nerfpops

This comment has been minimized.

nerfpops commented Apr 20, 2016

While installing strace i noticed that ps aux returned

COMMAND
postgrest postgres://......
/bin/bash
[sleep] <defunct>
[sleep] <defunct>
ps aux

When I pinged PostgREST i got a response, and this was logged:

sendWakeup: invalid argument (Bad file descriptor)
172.19.0.1 - - [20/Apr/2016:08:17:23 +0000] "GET / HTTP/1.1" 200 - "" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) ....

The following requests got rejected with

Control.AutoUpdate.mkAutoUpdate: worker thread exited with exception: sendWakeup: invalid argument (Bad file descriptor)

After restarting, ps aux had no [sleep] and PostgREST worked as expected.

@nerfpops

This comment has been minimized.

nerfpops commented Apr 20, 2016

Since PostgREST is always given pid 1 in the docker container I assume the strace command should be

strace -ff -e trace=file -p 1

The error I'm getting as root is:

strace: attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted
@ruslantalpa

This comment has been minimized.

Collaborator

ruslantalpa commented Sep 19, 2017

please try the 4.3 relaase in docker postgrest/postgrest and see if it works there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment