Comments (2)
This part here:
conn->send(malloy::buffer(doc), [conn, handler = std::move(handler)]...
Is the issue. See this line:
malloy/lib/malloy/websocket/connection.hpp
Line 198 in 8e1c364
doc
is decontructed and the memory pointed to it (which malloy::buffer
wraps but does not own see: asio docs) is deleted almost immediately.
You can wrap it in shared_ptr
as a quick and dirty way to keep it around (which is what accept_and_send
does iirc). The behaviour is a bit of a gotcha tbh, I'm open to ideas of how to make it less of a sharp corner :p.
from malloy.
Something about shooting yourself in the foot...? :p
The embarrassing thing is that I am/was aware of that and even read that notice when investigating.
This looks like a tricky case to take the edge off. I can currently not think of anything rather than a wrapper which creates the shared_ptr
automatically. But then again, the details are so usage specific that it will most likely not be very beneficial of providing an out-of-the-box solution with malloy
.
I think implementing application specific handlers similar to how the ws_handlers.cpp
in /examples
does it is the way to go - but that is application side, not malloy
side.
from malloy.
Related Issues (20)
- Usage of start() HOT 9
- Client: SNI hostname on WSS connection
- HTTP: More centralized configuration
- Connection timeout configuration
- Cross-Platform Way to Get Root Certs From Store? HOT 4
- server::listener: provide method for catching binding errors
- HTML form: check for requires fields HOT 2
- HTTP server: Add cache control HOT 1
- HTML form: populate() potentially dangerous HOT 1
- Custom HTTP response generator
- controller i/o threads reservation
- Form parsing should honor Content-Type
- Deprecate HTML namespace
- Generator response types HOT 1
- CMake: Check Windows 11 implementation for get_WIN32_WINNT
- HTTP Client: Allow connection re-use
- Potential issue in session cookie handling
- HTTP: Improve cookie handling
- HTTP connection detector: Different logging styles
- Consider using Botan for host certificate store access HOT 2
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 malloy.