Comments (8)
I think this is the same issue I'm seeing in issue #33.
from pistache.
Hello guys,
Thanks for reporting the issue. I'll try to take a look this week-end when I get some free time.
from pistache.
Alright so I will try to reproduce the issue in a unit test and hopefully fix it
from pistache.
Ok so I might have found the issue and pushed a fix for it: e1ad446
Following is my explanation of the bug.
When sending large files or large payloads over the socket, the internal kernel buffer reaches its limit (SO_SNDBUF
) and ::send()
then returns -1 with errno
being EAGAIN
, meaning that the buffer is full and the fd is not ready anymore to send data. When that happens, if Pistache does not own the underlying buffer it's trying to send, it will then try to make a copy of the buffer from the offset where it needs to start sending data when the fd becomes ready again. However, when attempting to copy a buffer from an offset > 0, I was triggering an exception because of an invalid if which is then catched by the handler and triggers the 500 Internal Server Error.
I just fixed the invalid if, let me know if it solves your issue, and I'll add some more unit-tests to make sure it works
from pistache.
I'm having a similar issue, on the latest master, sending a 338 KB file over the wire. As a test, I tried a file that has numbers 1-50000, with each number on its own line. What I'm seeing served from pistache is a file that has the same number of bytes plus 2, and at byte 143012 of 338896, the contents of the file wrap around and start over.
...
22015
22015
220171
2
3
4
...
the same thing happens further down at byte 280252 of 338896
...
21191
21192
211
2
3
...
I'm not really sure how to fix this problem, and I've got a deadline :( Is there any advice on what could be done?
from pistache.
Ok, on that last one, we fixed it so that we can serve large requests, and I will create a pull request.
from pistache.
Should be closed? #79 was merged.
from pistache.
Could be; my fix was aimed at serveFile(), and this does look very similar, though I'm not certain that this is the same problem. I did just test it, however, using response.send(), and it worked with a 1.4 MB response, so it's probably fixed. His code should probably be checked before and after the change though, to be certain.
from pistache.
Related Issues (20)
- [BUG] ResponseWriter::setCompression() chokes on identity encoding
- [BUG] Fails to fetch build dependencies in autopkgtest HOT 7
- [BUG] All PPA builds failing due to missing zlib headers
- [BUG] New compression code fails to build on armhf HOT 5
- decode uri
- Complete BSD support HOT 4
- "Stack smashing detected" error in ubuntu docker container HOT 17
- New release to conan HOT 1
- keep alive timeout doesn't add to response header
- Pistache very poor performance when POST size exceeds `Endpoint::options().maxRequestSize()`, and `maxRequestSize` is large. HOT 4
- Out of bound read in std::strtol while parsing HTTP requests HOT 4
- Endpoint::Options::backlog_ is not used HOT 2
- What's up with the logging? HOT 3
- [FEATURE REQUEST] Add support for zstd compression
- ci: coverage fails on debian:testing runners HOT 3
- Cant stream MJPEG with multipart/x-mixed-replace HOT 2
- releasing / tagging HOT 1
- Pistacheio support for QNX
- “stack smashing detected” error when processing Get requests via generated-cpp-pistache-server HOT 6
- failed to build example HOT 4
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 pistache.