Skip to content

expose processClient #12325

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

Closed
wants to merge 5 commits into from
Closed

expose processClient #12325

wants to merge 5 commits into from

Conversation

disruptek
Copy link
Contributor

This allows a server to be written that can capture exceptions yielded by this procedure without leaving its event loop.

disruptek and others added 2 commits October 1, 2019 11:17
This allows a server to be written that can capture exceptions yielded by this procedure without leaving its event loop.
@narimiran
Copy link
Member

This is a change in API, not a (critical) bug fix — I don't think it should have [backport] tag, and the change/addition should be mentioned in the changelog.

(For future PRs: even it were just a simple bugfix, CIs should definitely run on it, so no [no ci] either)

@disruptek disruptek changed the title [no ci] expose processClient [backport] expose processClient Oct 1, 2019
@dom96
Copy link
Contributor

dom96 commented Oct 1, 2019

I don't like this change. Can you elaborate on what you're trying to achieve and why you need to this to be exported?

capture exceptions yielded by this procedure without leaving its event loop.

I don't really follow this reasoning at all.

@dom96
Copy link
Contributor

dom96 commented Oct 20, 2019

So I believe I ran into something very similar to what you're trying to fix. The use case is as follows:

  • I'm running the async event loop in my program
  • I want to run a temporary HTTP server
  • If I close that temporary HTTP server it'll crash my main async event loop

To me, exporting processClient and recreating the logic in the serve proc is just a workaround for this. The crux of the problem is that we all use asyncCheck, which will crash our event loop. Why don't we introduce an asyncExceptionHandler procedure that can be overridden and have asyncCheck call it whenever there is a problem? This way we can ensure we can handle this problem across all libraries.

@disruptek
Copy link
Contributor Author

Yes, it's a workaround by design. The problem you ran into seems more severe, unless I've missed something.

The problem this is trying to fix is with a more trivial "user level" async scenario that is actually the result of the design choices in the server loop itself. It's easily avoidable if one were to rewrite the loop, which is what the PR enables.

FWIW, you don't need to convince me: the export of processClient is intended to serve two people's needs:

  • zedeus needs a server that doesn't crash when an async client handler crashes
  • dom96 needs interface changes that break minimal existing code

What does this mythical handler do to callers of asyncCheck in the event of an exception? Does that meet the needs of zedeus and dom96?

@dom96
Copy link
Contributor

dom96 commented Oct 20, 2019

We could use zedeus' opinion in here :)

@disruptek
Copy link
Contributor Author

@zedeus ping Zed

@zedeus
Copy link
Contributor

zedeus commented Oct 20, 2019

My use case was simply using Jester with asynchttpserver, nothing more than that, not involving asyncCheck. I gave up on it after every request caused a crash when running behind nginx, I should probably investigate that and open an issue.

@disruptek
Copy link
Contributor Author

For posterity, here is the reproduction (which does not require nginx): https://github.com/zedeus/jester-example

@dom96
Copy link
Contributor

dom96 commented Oct 25, 2019

zedeus' issue seems like a bug in asynchttpserver. Working around it by using this new API and handling the Bad FD errors is not the right solution.

@disruptek disruptek closed this Oct 25, 2019
@dom96
Copy link
Contributor

dom96 commented Oct 26, 2019

@disruptek @zedeus Do we have an issue which tracks this anywhere? here or Jester's repo?

@zedeus
Copy link
Contributor

zedeus commented Oct 26, 2019

I haven't had time to investigate the problem further so I haven't opened one, but I can do it now with the limited info I have

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

Successfully merging this pull request may close these issues.

4 participants