-
Notifications
You must be signed in to change notification settings - Fork 686
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
[Nim] Update httpbeast to v0.3 #4554
Conversation
e69b57f
to
e7f1ee4
Compare
e7f1ee4
to
2ea087b
Compare
Thanks for trying! Any chance you can try Ubuntu as the CI docker image for httpbeast? |
ebc5017
to
bc07407
Compare
Same issue with ubuntu @dom96 https://the-benchmarker.semaphoreci.com/jobs/19c2aca5-89a7-4d98-be09-5d23b7e17d9d |
This is very peculiar as it works just fine in HttpBeast's CI: https://github.com/dom96/httpbeast/actions/runs/1133816001. Could it be some weird Docker-related problem? Although then it would work for you on macOS, sadly I don't have access to my MBP right now so can't test. Any chance you'd be willing to bisect httpbeast to see what introduces the bug on macOS? |
At first glance, the reuse port option seems troubling, but I will take a deeper look |
a3cf7f0
to
25a4990
Compare
Two scenarios are OK :
|
@waghanza but did 0.3.0 stop using AF_INET6? I looked at the changes between the versions and nothing really seemed to stick out that could cause this. |
Indeed, ans the error stack (when disabling cli option) point to a logging cause -> to investiguate |
The full stack is Starting 4 threads
Listening on port 3000
/root/.nimble/pkgs/httpbeast-0.3.0/httpbeast.nim(318) eventLoop
/nim/lib/pure/net.nim(275) newSocket
/nim/lib/pure/includes/oserr.nim(94) raiseOSError
Error: unhandled exception: Address family not supported by protocol [OSError] |
@dom96 I can see in dom96/httpbeast@v0.2.2...v0.3.0 that domain is set in 3.0 ( |
@waghanza I see, but it uses the same default as the stdlib (https://nim-lang.org/docs/net.html#newSocket%2CSocketHandle%2CDomain%2CSockType%2CProtocol). So when the value isn't specified it should still be using |
Yes @dom96. Since, it works with However, without any custom Settings it works. The full stack trace is Starting 8 threads
Listening on port 3000
/Users/xxxx/.nimble/pkgs/httpbeast-0.3.0/httpbeast.nim(318) eventLoop
/usr/local/Cellar/nim/1.4.8/nim/lib/pure/net.nim(275) newSocket
/usr/local/Cellar/nim/1.4.8/nim/lib/pure/includes/oserr.nim(94) raiseOSError
Error: unhandled exception: Bad file descriptor [OSError] |
@dom96 The actual code works. However, I had to specify I do not know |
a1977be
to
48e6916
Compare
It's the return type of the procedure. In most cases |
I still am quite confused by this problem. The default should be |
Me too |
@dom96 without specifying |
nim/httpbeast/server.nim
Outdated
@@ -11,4 +11,4 @@ proc onRequest(req: Request): Future[void] = | |||
if req.path.get() == "/user": | |||
req.send(Http200, "") | |||
|
|||
run(onRequest, Settings(port: Port(3000))) | |||
run(onRequest, Settings(port: Port(3000), domain: Domain.AF_INET)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Well here is your bug, please use initSettings
instead which will set the defaults properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I see ... https://github.com/dom96/httpbeast/blob/b33dba93a134faa2adc3b991cb69890375987076/src/httpbeast.nim#L464 should not be used directly unless using initSettings
however, should not httpbeast
use AF_UNSPEC
so as either IPv6 or IPv4 is determined on nim
level (depending on system ability) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
however, should not httpbeast use AF_UNSPEC so as either IPv6 or IPv4 is determined on nim level (depending on system ability) ?
not sure what you mean. You mean it should automatically choose IPv6 or IPv4 if AF_UNSPEC
is used? That's not something Nim supports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly @dom96. I think to follow standards httpbeast should use AF_UNSPEC
as long as nim should choose IPv4 or IPv6 depending on system abilities https://man7.org/linux/man-pages/man3/getaddrinfo.3.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waghanza but that's exactly what doesn't work, right? Maybe it's a problem on the Nim side, is that what you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. The network / transport layer is, in my opinion, a language concern.
Thanks for looking into it! |
Hi @dom96,
This
PR
update https://github.com/dom96/httpbeast to 0.3.On my os (
osx
), I could not startI however updated CI config so as to see any containers logs.
Hope this will be helpful
Closes #4449