-
Notifications
You must be signed in to change notification settings - Fork 32
improve error logging with file paths and context #352
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -353,17 +353,14 @@ class Concore{ | |||||||
| ostringstream ss; | ||||||||
| ss << infile.rdbuf(); // reading data | ||||||||
| ins = ss.str(); | ||||||||
| retrycount++; | ||||||||
| infile.close(); | ||||||||
| } | ||||||||
| else{ | ||||||||
| retrycount++; | ||||||||
| throw 505; | ||||||||
| } | ||||||||
| } | ||||||||
| //observed retry count in C++ from various tests is approx 80. | ||||||||
| catch(...){ | ||||||||
| cout<<"Read error"; | ||||||||
| cerr << "Error reading " << inpath << port << "/" << name << " (retry " << retry << ")" << endl; | ||||||||
| } | ||||||||
| retry++; | ||||||||
| } | ||||||||
|
|
@@ -416,16 +413,13 @@ class Concore{ | |||||||
| if(shmId_get != -1) { | ||||||||
| std::string message(sharedData_get, strnlen(sharedData_get, 256)); | ||||||||
| ins = message; | ||||||||
| retrycount++; | ||||||||
| } | ||||||||
| else{ | ||||||||
| retrycount++; | ||||||||
| throw 505; | ||||||||
| } | ||||||||
| } | ||||||||
| //observed retry count in C++ from various tests is approx 80. | ||||||||
| catch(...){ | ||||||||
| std::cout << "Read error" << std::endl; | ||||||||
| cerr << "Error reading from shared memory port " << port << " name " << name << " (retry " << retry << ")" << endl; | ||||||||
|
||||||||
| cerr << "Error reading from shared memory port " << port << " name " << name << " (retry " << retry << ")" << endl; | |
| cerr << "Error reading from shared memory port " << port << " name " << name << " (retry " << retry << ")" << endl; | |
| retrycount++; |
Copilot
AI
Feb 16, 2026
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 new error log in this catch(...) still drops the underlying failure reason. Prefer catching const std::exception& where possible and including e.what() (and/or errno/std::strerror(errno) for I/O failures) so the log is actionable beyond just the path.
Copilot
AI
Feb 16, 2026
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.
std::strncpy(sharedData_create, result.c_str(), 256 - 1) does not guarantee null-termination when the source is >= 255 bytes, which can leave stale bytes in shared memory and cause readers to see corrupted/concatenated messages. Explicitly null-terminate the buffer (and consider clearing it before copy) after the strncpy.
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.
retrycountis a public field used elsewhere in the repo (e.g., scripts printconcore.retrycount), but it is no longer incremented during retry attempts here. If the retry count is still intended to be observable, incrementretrycounton each failed retry (or remove the field and update callers/docs).