Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken pipe exception on high and rapid map zoom #9

Closed
Grandro opened this issue Dec 21, 2023 · 3 comments
Closed

Broken pipe exception on high and rapid map zoom #9

Grandro opened this issue Dec 21, 2023 · 3 comments

Comments

@Grandro
Copy link
Collaborator

Grandro commented Dec 21, 2023

int sock = *((int*)png_get_io_ptr(png_ptr));
size_t writes = 0;
while (writes != length) {
int64_t out =
write(sock, reinterpret_cast<char*>(data) + writes, length - writes);
if (out < 0) {
if (errno == EWOULDBLOCK || errno == EAGAIN || errno == EINTR) continue;
break;
}
writes += out;
}
}

In line 875 I sometimes get a Broken pipe exception when zooming on high zoom (where object dots/heatmap are bigger). This can also happen when zooming out from high zoom again. I think it only happens when zooming rapidly.

@patrickbr
Copy link
Member

I suspect this isn't a broken pipe exception (write() is a C function and therefore doesn't throw any exceptions), but a SIGPIPE signal.

Will try to replicate this and handle SIGPIPEs correctly here.

@patrickbr
Copy link
Member

patrickbr commented Dec 21, 2023

Can you try again using the latest master? SIGPIPE is now handled by SIG_IGN (ignore) explicitly in Server.cpp (it is already set so in util::Server, so I don't quite understand why you still received them). Additionally, all write() calls to the socket have been replaced by send() (write() with additional flags), and the MSG_NOSIGNAL flag is now always set).

Just out of curiosity: which OS are you using? I was unable to replicate this on an Ubuntu and a Debian system, even when adding a sleep(10) before line 874 and closing the socket immediately after the request, and under heavy load testing with hundreds of parallel requests per second. I had to explicitly re-set the default signal handler for SIGPIPE to get the behavior your described, so my guess is that some defaults differ between your system and our testing systems.

@Grandro
Copy link
Collaborator Author

Grandro commented Feb 1, 2024

Excuse my late reply. I am using Windows 11 + WSL but I was also not able to replicate the problem on Windows 10 + WSL back then. I just spent a few minutes rapidly zooming in and out, and the issue seems to be resolved. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants