-
Notifications
You must be signed in to change notification settings - Fork 301
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
dlt-connection: add socket timeout #439
Conversation
a0d22f8
to
0d131fa
Compare
Hi @alexmohr , |
I was never able to reproduce the issue in a synthetic test. It only happened from time to time on our hardware target. After changing this the issues are gone but I'm still not able to reproduce it in a unit test |
Thanks @alexmohr for your informative! |
src/daemon/dlt_daemon_connection.c
Outdated
#ifdef DLT_SYSTEMD_WATCHDOG_ENABLE | ||
char *watchdogUSec = getenv("WATCHDOG_USEC"); | ||
if (watchdogUSec) | ||
timeout.tv_sec = atoi(watchdogUSec) / 4000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be:
timeout.tv_sec = atoi(watchdogUSec) / 4000000; | |
{ | |
timeout.tv_sec = atoi(watchdogUSec) / 1000000; | |
timeout.tv_usec = atoi(watchdogUSec) % 1000000; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Hello @alexmohr , |
It's mainly used for the dlt-daemon events which are sent to the clients. |
We can keep them as separate PRs. As they are touching different code lines, it should not be a problem to merge them separately. |
in some scenarios a socket might block forever. This means dlt-daemon won't respond properly anymore. To fix this a timeout is added to the dlt-daemon socket connection. Signed-off-by: Alexander Mohr <[email protected]>
0d131fa
to
4501146
Compare
char *watchdogUSec = getenv("WATCHDOG_USEC"); | ||
if (watchdogUSec) { | ||
timeout.tv_sec = atoi(watchdogUSec) / 1000000; | ||
timeout.tv_usec = atoi(watchdogUSec) % 1000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fixed is fine.
in some scenarios a socket might block forever.
This means dlt-daemon won't respond properly anymore. To fix this a timeout is added to the dlt-daemon socket connection.
The program was tested solely for our own use cases, which might differ from yours.
Licensed under Mozilla Public License Version 2.0
Alexander Mohr, [email protected], Mercedes-Benz Tech Innovation GmbH, imprint