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

warp runSettingsSocket hangs when given a TCP socket instead of UNIX Domain socket #512

Closed
arianvp opened this Issue Feb 18, 2016 · 2 comments

Comments

Projects
None yet
1 participant
@arianvp

arianvp commented Feb 18, 2016

I am trying to get Systemd socket activation to work with Warp. so that I can run Warp on port 80 without root.

Basically, Systemd is listening on port 80 and as soon as a data is received, it starts up my warp server and passes on the listening sockets to the application through an environment variable LISTEN_FDS. I use the systemd hackage package to read out Sockets out of this environment variable directly.

The socket passed to warp is already bound and listening. So I thought I could simply use runSettingsSocket.

but runSettingsSocket doesn't seem to do anything. Warp simply hangs

The code for this is here: https://github.com/arianvp/hginx/blob/master/hginx/src/Main.hs#L88

To reproduce. execute:

/usr/lib/systemd/systemd-activate --listen="127.0.0.1:3000" stack exec hginx

and go to http://127.0.0.1:3000 and you'll see that no response is created. Whilst if you do:

stack exec hginx then we do get a response at that url.

@arianvp

This comment has been minimized.

Show comment
Hide comment
@arianvp

arianvp Feb 18, 2016

I'll try to work on a minimal example

Edit: updated the example. A mimial working example is now here: https://github.com/arianvp/hginx/blob/master/hginx/src/Main.hs#L88

arianvp commented Feb 18, 2016

I'll try to work on a minimal example

Edit: updated the example. A mimial working example is now here: https://github.com/arianvp/hginx/blob/master/hginx/src/Main.hs#L88

@arianvp

This comment has been minimized.

Show comment
Hide comment
@arianvp

arianvp Feb 18, 2016

adding System.Posix.Internals.setNonBlockingFD fd True fixed this

arianvp commented Feb 18, 2016

adding System.Posix.Internals.setNonBlockingFD fd True fixed this

@arianvp arianvp closed this Feb 18, 2016

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