ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.43k stars 889 forks source link

about the res_stream_threshold_ #419

Open kunknu opened 1 year ago

kunknu commented 1 year ago

environment:x86 ubuntu 20.04 crow version : 0.3 C++ 14

In my project, I used the server to respond to a request and returned data with an image encoded as base64, which exceeded 1MB in size. When I checked the source code, I found that there was a size limit (res_streamthreshold) when sending data. When I sent data exceeding this size, an error occurred. My ability is relatively low and I cannot make the correct modifications, but as long as I increase this limit, I can work correctly. Will this change cause problems elsewhere

Error log before modification : (2023-06-29 01:29:24) [INFO ] Crow/0.3 server is running at 0.0.0.0:5008 using 20 threads (2023-06-29 01:29:24) [INFO ] Call app.loglevel(crow::LogLevel::Warning) to hide Info level logs. (2023-06-29 01:29:29) [DEBUG ] 0x7fbba4009590 timer cancelled: 0 0 (2023-06-29 01:29:29) [DEBUG ] timer add inside: 0x7fbbfd3ff650 0 (2023-06-29 01:29:29) [DEBUG ] 0x7fbba4009590 timer added: 0x7fbbfd3ff650 0 (2023-06-29 01:29:29) [DEBUG ] 0x7fbba4009590 timer cancelled: 0x7fbbfd3ff650 0 (2023-06-29 01:29:29) [INFO ] Request: 127.0.0.1:41978 0x7fbba4009590 HTTP/1.1 POST /cv/pig-counting/1.0.1/ (2023-06-29 01:29:29) [DEBUG ] Matched rule '/cv/pig-counting/1.0.1/' 3 / 8

(2023-06-29 01:29:42) [DEBUG ] 0x7fbb4c003950 timer cancelled: 0 0 (2023-06-29 01:29:42) [DEBUG ] 0x7fbb4c003950 from read(1) (2023-06-29 01:29:42) [DEBUG ] 0x7fbb4c003950 is_reading 0 is_writing 1 (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 timer cancelled: 0 0 (2023-06-29 01:29:43) [DEBUG ] timer add inside: 0x7fbbfb3fb650 0 (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 timer added: 0x7fbbfb3fb650 0 (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 timer cancelled: 0x7fbbfb3fb650 0 (2023-06-29 01:29:43) [INFO ] Request: 127.0.0.1:43866 0x7fbb4c005010 HTTP/1.1 POST /cv/pig-counting/1.0.1/ (2023-06-29 01:29:43) [DEBUG ] Matched rule '/cv/pig-counting/1.0.1/' 3 / 8 caling[1688002183]------------------------------- getc size 1048576 (2023-06-29 01:29:43) [INFO ] Response: 0x7fbb4c005010 /cv/pig-counting/1.0.1/ 200 1 (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 from write (sync)(1) (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 is_reading 1 is_writing 1 (2023-06-29 01:29:43) [ERROR ] system:9 - happened while sending buffers (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 from write (sync)(2) (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 is_reading 1 is_writing 1 (2023-06-29 01:29:43) [ERROR ] An uncaught exception occurred: write: Bad file descriptor [system:9] (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 timer cancelled: 0 0 (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 from read(1) (2023-06-29 01:29:43) [DEBUG ] 0x7fbb4c005010 is_reading 0 is_writing 1 ^C(2023-06-29 01:29:45) [INFO ] Exiting.