Comments (12)
Thank you. How large messages do you send, and what client are you using? Will try to reproduce this error.
from simple-websocket-server.
I'm using Chrome Version 43.0.2357.81 (64-bit).
Here is my sample code
I'm sending 650kb-75mb per message (a matrix of floats) within this loop.
from simple-websocket-server.
I have tried messages up to 2GB, both text and binary, on OS X and Debian testing, however I was unable to reproduce the error. What is the exact message Chrome displays when you get the protocol corruption (websocket-protocol I take it)?
from simple-websocket-server.
Sorry about the delay!
Client side this is the error i get:
WebSocket connection to 'ws://128.52.175.133:8080/compute/spectrogram/' failed: Invalid frame header
Server side:
Server: Error in connection 140005263548336. Error: asio.misc:2, error message: End of file
or sometimes:
Server: Closed connection 140005129325408 with status code 1002
from simple-websocket-server.
I cannot find anything wrong, either with your code nor mine. Would you mind trying with NUM_THREADS set to 1? Just to rule out threading problems. When I think about it, can your json library handle multiple threads? Is it thread safe? I know I had a similar problem with Boost.PropertyTree in https://github.com/eidheim/Simple-Web-Server/blob/master/http_examples.cpp. The solution here was to add "#define BOOST_SPIRIT_THREADSAFE" before including the json-headers (#include <boost/property_tree/ptree.hpp> and #include <boost/property_tree/json_parser.hpp>).
from simple-websocket-server.
Were you able to reproduce the error I'm seeing?
Setting NUM_THREADS to 1 still gives the error :(. and it seems that the
library is thread safe: dropbox/json11#29
Any thoughts?
On Wed, Jun 17, 2015 at 8:26 PM, Ole Christian Eidheim <
[email protected]> wrote:
I cannot find anything wrong, either with your code nor mine. Would you
mind trying with NUM_THREADS set to 1? Just to rule out threading problems.
When I think about it, can your json library handle multiple threads? Is it
thread safe? I know I had a similar problem with Boost.PropertyTree in
https://github.com/eidheim/Simple-Web-Server/blob/master/http_examples.cpp.
The solution here was to add "#define BOOST_SPIRIT_THREADSAFE" before
including the json-headers (#include and #include ).—
Reply to this email directly or view it on GitHub
#11 (comment)
.
from simple-websocket-server.
I would try have a look at data_ss in void send_message after line 44. Print out data_ss.str() in hex or something and see if it looks correct when you get the crash. I see a similar crash in my test if I send a stream object that has data that is concurrently accessed. This should not happen, but if there is a overflow in the data that is put into the stream, I guess this can happen.
from simple-websocket-server.
cool, i'll check it out but this is progress :) is there different way to send data? (I was just following your example provided ws_examples.cpp
)
from simple-websocket-server.
Ok so printing the hex is really difficult to see if there is a problem because there are so many values however I can see from the client output that the data it receives is malformed when after the server crashes (so the client may receive the first message completely, although malformed and on the next request the server crashes). This points to the data_ss
buffer being concurrently modified, perhaps within the server send
method, https://github.com/eidheim/Simple-WebSocket-Server/blob/master/server_ws.hpp#L137?
from simple-websocket-server.
Ok so for a temporary fix: joshblum/eeg-toolkit@e75434a
Although it would be nice if the library could support concurrent requests (or if you have pointers if my code is using any bad practices) for a more permanent fix :)
from simple-websocket-server.
I think you have a buffer overflow somewhere, and this is causing the stream to become malformed in some way. Since its working after you added the mutex, the overflow might happen in this for loop: https://github.com/joshblum/eeg-spectrogram/blob/master/ws_server.cpp#L141-L154.
from simple-websocket-server.
Closing this issue, either it was a buffer overflow (in your code), or copying of stream pointers lead to stack overflow. The latter is fixed now.
from simple-websocket-server.
Related Issues (20)
- [suggest] Send/Broadcast and Text/BinaryMode HOT 1
- Standalone Asio not found - but asio.hpp is present HOT 4
- re again WssClient::start causes on_error HOT 10
- When I use Google Chrome it happend a error. HOT 3
- exception thrown in server start (boost related) HOT 4
- Connection Timeout HOT 2
- Create example on how to stream data to a client HOT 1
- Unable to compile against standalone asio HOT 1
- How to stop the server? HOT 3
- Installed but ws_examples throws an error HOT 1
- Support for the Sec-WebSocket-Protocol field HOT 3
- fatal error C1083: Cannot open include file : 'pthread.h': No such file or directory HOT 1
- Messages split among frames aren't reasembled HOT 25
- Openssl wants void* instead of char* in 0x1000115fL HOT 1
- how to initiate send message from client HOT 3
- Client request error: End of file
- Access violation exeption HOT 3
- gdiplus
- Can't use wss client HOT 5
- Integration with Simple-Web-Server 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 simple-websocket-server.