Patch: Add support for chroot to Worker#user V2

2017-03-21 Thread Jeremy Evans
Here's V2 of the chroot support patch. This changes the commit message language, and supports chrooting to a directory that isn't the current directory. >From 9bd82792d57f54a868c9a0e9af2bd452f3ef298d Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Tue, 21 Feb 2017

Re: check_client_connection using getsockopt(2)

2017-03-21 Thread Simon Eskildsen
On Wed, Feb 22, 2017 at 8:42 PM, Eric Wong wrote: > Simon Eskildsen wrote: > > Thanks for the writeup! > > Another sidenote: It seems nginx <-> unicorn is a bit odd > for deployment in a containerized environment(*). > >> I meant to ask, in Raindrops

Re: Patch: Add after_worker_ready configuration option

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > This adds a hook that is called after the application has > been loaded by the worker process, directly before it starts > accepting requests. This hook is necessary if your application > needs to get gain access to resources during initialization, >

mail queue breakage :x

2017-03-21 Thread Eric Wong
Apologies for the flood of mail, apparently there was a lot of stuff backed up for a month which was getting archived but not delivered. Anyways NNTP and HTTPS archives have been working, and I forgot SMTP was still supposed to go out :x nntp://news.public-inbox.org/inbox.comp.lang.ruby.unicorn

Re: Patch: Add support for chroot to Worker#user

2017-03-21 Thread Jeremy Evans
On 02/21 07:53, Eric Wong wrote: > Jeremy Evans wrote: > > Any chrooting would need to happen inside Worker#user, because > > you can't chroot until after you have parsed the list of groups, > > and you must chroot before dropping root privileges. > > > > chroot is an

[PATCH] check_client_connection: use tcp state on linux

2017-03-21 Thread Simon Eskildsen
The implementation of the check_client_connection causing an early write is ineffective when not performed on loopback. In my testing, when on non-loopback, such as another host, we only see a 10-20% rejection rate with TCP_NODELAY of clients that are closed. This means 90-80% of responses in this

Re: check_client_connection using getsockopt(2)

2017-03-21 Thread Simon Eskildsen
On Wed, Feb 22, 2017 at 1:33 PM, Eric Wong wrote: > Simon Eskildsen wrote: > > great to know it's still working after all these years :> > >> This confirms Eric's comment that the existing >> `check_client_connection` works perfectly on loopback, but

[PATCH] unicorn_http: reduce rb_global_variable calls

2017-03-21 Thread Eric Wong
rb_global_variable registers the address of the variable which refers to the object, instead of the object itself. This adds extra overhead to each global variable for our case, where the variable is frozen and never changed. Given there are currently 59 elements in this array, this saves 58

Re: Patch: Add after_worker_ready configuration option

2017-03-21 Thread Jeremy Evans
On 02/23 09:23, Eric Wong wrote: > Jeremy Evans wrote: > > On 02/23 02:32, Eric Wong wrote: > > > Jeremy Evans wrote: > > > Anyways, I'm somewhat inclined to accept this as well, but will > > > think about it a bit, too. > > > > > > One problem I have

[PATCH] t0011-active-unix-socket.sh: fix race condition in test

2017-03-21 Thread Eric Wong
Killing the master process may lead to the worker dying on its own (as designed); before kill(1) has had an opportunity to send the second kill(2) syscall on the worker process. Killing the worker before the master might also lead to a needless respawn, so merely kill the master and let the

Re: [PATCH] check_client_connection: use tcp state on linux

2017-03-21 Thread Simon Eskildsen
> I prefer we use a hash or case statement. Both allow more > optimization in the YARV VM of CRuby (opt_aref and > opt_case_dispatch in insns.def). case _might_ be a little > faster if there's no constant lookup overhead, but > a microbench or dumping the bytecode will be necessary > to be sure

[PATCH] oob_gc: rely on opt_aref_with optimization on Ruby 2.2+

2017-03-21 Thread Eric Wong
Maybe oob_gc probably isn't heavily used anymore, maybe some Ruby 2.2+ users will benefit from this constant reduction. Followup-to: fb2f10e1d7a72e67 ("reduce constants and optimize for Ruby 2.2") --- lib/unicorn/oob_gc.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

Re: Patch: Add after_worker_exit configuration option

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > Here's a revised patch that should address the issues you identified: Thanks. Pushed as 2af91a1fef70d6546ee03760011c170a082db667 I needed one change to an integration test to workaround the lack of reader attribute, but I'd rather pay the cost in the

Re: [PATCH] Add worker_exec configuration option V2

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > On 03/10 09:19, Eric Wong wrote: > > tests, later, or you can. I also had some FreeBSD test fixes > > (which might apply to OpenBSD) on a VM somewhere which I'll Cc: > > you on: there was also just SO_KEEPALIVE fix I posted: > > > >

Re: [PATCH] Add worker_exec configuration option V2

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > Here's a patch to fix the stack depth issue: Thanks, applied with some trailing whitespace fixups. (I suggest enabling the pre-commit hook distributed with git in $GIT_DIR/hooks/pre-commit, it'll run "git diff-index --check ..." to check that) >

Re: [PATCH] check_client_connection: use tcp state on linux

2017-03-21 Thread Eric Wong
Awesome! Thanks for the update. I'll merge ccc-tcp-v3 into master soon and push out 5.3.0-rc1 (Maybe there's need to quote at all, every message is archived forever in several public places: https://bogomips.org/unicorn-public/ https://www.mail-archive.com/unicorn-public@bogomips.org

[PATCH 2/3] revert signature change to HttpServer#process_client

2017-03-21 Thread Eric Wong
We can force kgio_tryaccept to return an internal class for TCP objects by subclassing Kgio::TCPServer. This avoids breakage in any unfortunate projects which depend on our undocumented internal APIs, such as gctools Cc: Aman Gupta ---

[PATCH] test-lib: expr(1) portability fix

2017-03-21 Thread Eric Wong
GNU expr supports '+' to match one or more occurrences, but it seems the expr(1) on my FreeBSD installation does not. --- This only covers the Bourne sh integration tests in t/ I still don't trust the Ruby language (and test libraries written in it) to not change incompatibility after all

Re: [PATCH] check_client_connection: use tcp state on linux

2017-03-21 Thread Simon Eskildsen
Looks like Puma encountered some issues with some Linux distro's kernels not supporting this. That's crazy.. https://github.com/puma/puma/issues/1241

Re: Patch: Add after_worker_exit configuration option

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > On 02/21 07:43, Eric Wong wrote: > > Jeremy Evans wrote: > > > This option can be used to implement custom behavior for handling > > > worker exits. For example, let's say you have a specific request > > > that crashes a worker

Re: check_client_connection using getsockopt(2)

2017-03-21 Thread Eric Wong
Simon Eskildsen wrote: > On Wed, Feb 22, 2017 at 8:42 PM, Eric Wong wrote: > > Simon Eskildsen wrote: > >> I meant to ask, in Raindrops why do you use the netlink API to get the > >> socket backlog instead of

Re: Patch: Add after_worker_exit configuration option

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > This option can be used to implement custom behavior for handling > worker exits. For example, let's say you have a specific request > that crashes a worker process, which you expect to be due to a > improperly programmed C extension. By modifying your

Re: Patch: Add after_worker_ready configuration option

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: acknowledging everything above. > On 02/23 02:32, Eric Wong wrote: > > Jeremy Evans wrote: > > Anyways, I'm somewhat inclined to accept this as well, but will > > think about it a bit, too. > > > > One problem I have with this

Re: [PATCH] Add worker_exec configuration option

2017-03-21 Thread Eric Wong
Jeremy Evans wrote: > Thanks for your detailed review. I will work on an updated patch and > try to send it tomorrow or Friday. No problem and no rush; I might be out a bit the next few days. -- unsubscribe: unicorn-public+unsubscr...@bogomips.org archive:

Re: mail queue breakage :x

2017-03-21 Thread Eric Wong
Maybe the attached script will help detect mirror mismatches in the future (run via cron). But of course the original mail failure was due to the crontab of the mlmmj user getting clobbered :x Anyways, feel free to exit/run it yourself, with or without tor and add mirrors and whatnot. And you

Re: mail queue breakage :x

2017-03-21 Thread Eric Wong
Eric Wong wrote: > Anyways, feel free to exit/run it yourself, with or without tor > and add mirrors and whatnot. And you can hammer the hell out Just be warned that attached validation script checks against deliveries to mail-archive.com; so no, don't hammer the