Comments (7)
It looks like this is using the overload of requestHTTP
that returns the response instead of the one that passes it as scope
to a callback. If that call is directly in your code, you could probably replace it with the scope
version to work around the crash.
For the crash itself, it looks like might be an order-of-destruction issue, where the GC destroys the referenced ConnectionPool
prior to the LockedConnection
that is as part of the HTTPClientResponse
. I'm not sure whether there is a simple fix (backwards compatible) within the library to avoid that, or if this is an obligation that needs to be passed to the user for now.
In the latter case, it would be necessary to catch the exception, either directly, or indirectly using a scope (failure)
guard, and call HTTPClientResponse.disconnect()
to ensure the response object frees any associated resources in time.
from vibe.d.
It looks like this is using the overload of requestHTTP that returns the response instead of the one that passes it as scope to a callback. If that call is directly in your code, you could probably replace it with the scope version to work around the crash.
Sadly no, I do not directly make the requestHTTP call, that is being done by connectWebSocket
from vibe.d.
Okay, then there is also an overload of connectWebSocket
that takes a WebSocketHandshakeDelegate
that internally uses the other connectHTTP
overload. I'll have a look at the exception handling in the web socket module later.
from vibe.d.
From what I can tell, I can't use the scope callback as the socket has to be a long lived object that is queried in a loop in things like games.
from vibe.d.
Having it long lived shouldn't be an issue, the task is light-weight and as long as it doesn't perform heavy computations, it shouldn't interfere with anything else in the main thread. The task could then be connected to other tasks/threads by establishing a two-way communication channel, which, in contrast to std.concurrency
, is strongly typed and doesn't allocate for each message.
from vibe.d.
I would need to figure out how to start/stop it on command, seems difficult considering how scope will destroy the object after it exits the scope
from vibe.d.
Channel
has a close
method and is reference counted (a copy would exist on both sides), so that could be used to safely communicate the end of the connection/scope.
from vibe.d.
Related Issues (20)
- Can't build on (AWS ?) Linux HOT 3
- Unable to call the get method from the request form HOT 2
- Getting and sending JSON correctly HOT 1
- [Bug] Unable to call WebSocket.request._query.get() due to const HOT 1
- [CLOSED] How to deal with generated code via preBuildCommands? HOT 1
- Error when building on Raspberry Pi HOT 1
- notls has no effect
- build fails linking ssl - mac HOT 1
- Any way to write headers after response handler returns? HOT 2
- [bug] why "runWorkerTaskH" executes in same thread for multiple jobs/connections? HOT 2
- [vibe.d] WebSocket mess with "cast(shared) ..." HOT 1
- Access log is pretty useless for vibe server behind a proxy HOT 3
- Proposal: remove whole Meson support at all HOT 11
- Regression #249 - failed to listen to address with default
- Invalid character in internet path. HOT 6
- How to get the client's MAC address in Vibe HOT 2
- Files are not uploaded using nested paths HOT 7
- Error on creating a mongo connection HOT 7
- Use Promises for REST JS clients
- an example email sent through Gmail HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vibe.d.