-
Notifications
You must be signed in to change notification settings - Fork 81
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
Basic Bandit example in Documentation does not work - gives error of unclear significance. Solution? #404
Comments
There's nothing wrong with how you've set up Bandit; it's running and serving your plug just fine. The example is correct. The issue you're seeing is an error indicating that Bandit errored attempting to read headers from your client. Typically this is a client-side or network issue, where the complete client request does not make it to the server (hence the error). The reality of network facing logic is that there's always remote issues of one type or another; you'll never be rid of them entirely. That being said, this does suggest a misbehaving client of one type or another. What client were you using? |
I have run this as follows:
I note the errors are not related. There are two: EConnAborted
Header Timeout
These do not occur at the same time, but randomly. I so far cannot identify what is causing them or how to trigger them reliably. Sometimes I get them, sometimes I don't. But they keep happening. Is there any way to debug further the cause or handle these errors in some way? I can appreciate that perhaps things may never be perfect, but this is the simplest proof of concept for the Bandit server system I can imagine and I am already being spammed with errors, which is not ideal. I have also tested as per the documents WebSocket system which provides the same errors:
Is there some way to gather more information about these errors? It seems they are all being processed and outputted in your code, not anything I have access to. Is that correct? Or can I do something with Thanks for any help. |
I tested the code with Cowboy instead. So far, since switching to Cowboy I have seen neither of these two errors again. Thus I do believe this is Bandit bug. I would prefer to use Bandit, because as you say it is more efficient. But error free basic function is necessary as well. If I am getting errors from the most ideal simple basic test on a single computer, this does not bode well for a large scale application. I would be very interested in any fix if you can think of anything to try. Bug ProjectI posted a bug project here: https://github.com/jonmdev/bandit_bug In Application.ex you can comment in or out the Bandit or Cowboy version:
Seems to work smoothly and no errors for either with Cowboy. While Bandit recurrently (though unpredictably) provides the two errors in this thread. Reproduction Steps
Thanks for any help or thoughts. |
If you make a project as per:
https://hexdocs.pm/plug/readme.html
https://hexdocs.pm/bandit/Bandit.html
You can get:
If you add this to a project and then run
ServerTest.start_http_server()
, then go localhost:4000 you will get a “Hello world” back. This is fine. However, you will also get this:I can find no information on what this means. With such simple code I am not creating any GenServer myself so this is obviously a GenServer that is running inside the Bandit code.
Is this a bug or is there something missing in the documentation to avoid this? What is the fix?
The text was updated successfully, but these errors were encountered: