Skip to content
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

Apache with mod_neko hangs up on service reload #199

Open
maxless opened this issue Aug 30, 2019 · 10 comments
Open

Apache with mod_neko hangs up on service reload #199

maxless opened this issue Aug 30, 2019 · 10 comments

Comments

@maxless
Copy link

maxless commented Aug 30, 2019

Clean Ubuntu 18.04 install with Apache 2.4.29 with mod_neko enabled. Using service reload hangs apache so I have to kill -9 it manually:

root@Ubuntu-1804-bionic-64-minimal ~ # service apache2 restart
root@Ubuntu-1804-bionic-64-minimal ~ # ps ax| grep apa
10146 ?        Ssl    0:00 /usr/sbin/apache2 -k start
10162 ?        S      0:00 /usr/sbin/apache2 -k start
10163 ?        S      0:00 /usr/sbin/apache2 -k start
10164 ?        S      0:00 /usr/sbin/apache2 -k start
10165 ?        S      0:00 /usr/sbin/apache2 -k start
10166 ?        S      0:00 /usr/sbin/apache2 -k start
10168 pts/0    S+     0:00 grep --color=auto apa
root@Ubuntu-1804-bionic-64-minimal ~ # service apache2 reload
root@Ubuntu-1804-bionic-64-minimal ~ # ps ax| grep apa
10146 ?        Ssl    0:00 /usr/sbin/apache2 -k start
10162 ?        Z      0:00 [apache2] <defunct>
10163 ?        Z      0:00 [apache2] <defunct>
10164 ?        Z      0:00 [apache2] <defunct>
10165 ?        Z      0:00 [apache2] <defunct>
10166 ?        Z      0:00 [apache2] <defunct>
10196 pts/0    S+     0:00 grep --color=auto apa
root@Ubuntu-1804-bionic-64-minimal ~ # strace -p 10146
strace: Process 10146 attached
futex(0x7f75c6a02214, FUTEX_WAIT_PRIVATE, 4294967277, NULL) = -1 EAGAIN (Resource temporarily unavailable)
futex(0x7f75c6a02214, FUTEX_WAIT_PRIVATE, 4294967267, NULL
^Cstrace: Process 10146 detached
 <detached ...>

Removing mod_neko config files allows the Apache to reload correctly.

@andyli
Copy link
Member

andyli commented Aug 30, 2019

Are you using mpm prefork mode? It's the only mode that Neko supports.
You may reference how we config Apache for the haxelib server in https://github.com/HaxeFoundation/haxelib/blob/development/Dockerfile.

@maxless
Copy link
Author

maxless commented Sep 2, 2019

   Server Version: Apache/2.4.29 (Ubuntu)
   Server MPM: prefork
   Server Built: 2019-07-16T18:14:45

Server status page says I do.

From the dockerfile I think that means you use mod_tora explicitly to handle requests:

		echo 'LoadModule neko_module /usr/lib/x86_64-linux-gnu/neko/mod_neko2.ndll'; \
		echo 'LoadModule tora_module /usr/lib/x86_64-linux-gnu/neko/mod_tora2.ndll'; \
		echo 'AddHandler tora-handler .n'; \

I tested it out and, indeed, mod_tora works correctly with reload. But if I add this first line LoadModule neko..., it breaks.

@mockey
Copy link

mockey commented Nov 19, 2019

I can confirm this. I have an old project built on mod_neko2 and I see this problem on Ubuntu 18.04 as well.
systemctl reload apache2 is used e.g. by certbot when renewing letsencrypt certs, so this is not so good.
Restart seems to work OK, though.

Server version: Apache/2.4.29 (Ubuntu)
Server built:   2019-09-16T12:58:48
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)

@maxless
Copy link
Author

maxless commented Nov 20, 2019

As a quick fix in my case since it was behind nginx anyways, I've just started tora server in fcgi mode (the git version iirc) and configured nginx to use it to handle index.n and removed Apache altogether, hope that helps.

@mockey
Copy link

mockey commented Nov 20, 2019

Thanks, I'll probably do that as well. Normally I use nginx anyway nowadays. I installed apache just because of mod_neko. Does tora run reliably in fcgi mode?

@jonasmalacofilho
Copy link
Member

I find it very reliable, yes.

Just make sure you have HaxeFoundation/tora#15 if you care about multipart/form-data (i.e. use tora from git).

@mockey
Copy link

mockey commented Nov 21, 2019

OK, I'll give it a try. Is it possible to use PUT as well with tora?

@jonasmalacofilho
Copy link
Member

jonasmalacofilho commented Dec 26, 2019

Sorry about missing this comment @mockey.

From the top of my mind, it should. But I confess to not knowing if there's isn't anyplace that's hardcoded to ignore PUTs. But if there are, they should be easy to fix.

One thing that does come to mind though is that the only streaming API on the Haxe side is parseMultipart, which IIRC always checks for the suitable verb and headers.

@mockey
Copy link

mockey commented Jan 4, 2020

Will try this, thanks.

@mockey
Copy link

mockey commented Jul 11, 2023

I ran into this bug again after upgrading an old server. I suppose it won't get fixed, right?
I can't switch to nginx as suggested above. It's quite annoying actually, because apache reload is used by quite a lot of programs, e.g. logrotate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants