D
D
Danil Tunev2019-12-04 17:20:15
linux
Danil Tunev, 2019-12-04 17:20:15

Why does the server crash on Linux?

Hello. I no longer know what to do, stand on my head or believe in magic? I'm testing a server written on Berkeley sockets + event-driven epoll (edge-triggered), sockets are not blocking, requests are processed in one thread, the system kernel is linux-4.9.0-8-686-pae. While I was struggling with the problem, the whole code section was left with a "skeleton", so it's hard to get confused, although initially everything was perfected, but damn it ..., it turned out to be a worthless blade). In general, I start the server, I start the client on the same computer (the client creates several tcp connections through them and sets requests, receives answers), I make about 100-200 requests and responses. From the beginning, everything is ok (10-20 requests without glitches), but with each new request, the client starts to freeze (as if not enough data has arrived). The last requests generally begin with the establishment of a tcp connection and a reset from the server side, since the epoll event number says that it is necessary to disconnect and this is at best, at worst, the server writes, writes, writes, and then falls on the write () functions, while the number written bytes before the fall is always equal to 21888 (on responses of different lengths)? I checked all the library functions for errors, everything works correctly, I looked at errno after a crash write (), everything is zero. What the hell?) Give at least some food for thought, otherwise I don’t know what to think. and then falls on the write() functions, while the number of bytes written before the fall is always 21888 (on responses of different lengths)? I checked all the library functions for errors, everything works correctly, I looked at errno after a crash write (), everything is zero. What the hell?) Give at least some food for thought, otherwise I don’t know what to think. and then falls on the write() functions, while the number of bytes written before the fall is always 21888 (on responses of different lengths)? I checked all the library functions for errors, everything works correctly, I looked at errno after a crash write (), everything is zero. What the hell?) Give at least some food for thought, otherwise I don’t know what to think.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2019-12-04
@firedragon

Use punctuation, markup.
Perhaps you should pay attention to the paragraphs.
Paragraphs are important in the design of a piece of thought.
Also some people add logs.
But not always.
Always your engineer to remotely torture users who didn't do anything, it just so

C
CityCat4, 2019-12-04
@CityCat4

Give at least some food for thought, otherwise I don’t know what to think.

Something is overflowing. Perhaps new connections do not have time to be established or old ones are not closed fast enough. Perhaps some nuclear buffers are overflowing. But the fact that this overflow of something is indicated by the nature of the error - first quickly, then slower and slower, and then bamtz.

V
vanyamba-electronics, 2019-12-04
@vanyamba-electronics

Faced similar in Windows NT. If my memory serves me right, then in order for everything to work, the server, when responding, must spawn a new process, which will respond to the client.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question