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

Performs better checks in commix semaphore operations #2229

Merged
merged 3 commits into from Mar 29, 2021

Conversation

ncordon
Copy link
Contributor

@ncordon ncordon commented Mar 28, 2021

The commix garbage collector performs operations on semaphores (sem_open, sem_wait or sem_post). This PR adds assertions and prints to the stderr on those, exiting the process with errno if they fail.

Uses fprintf to stderr instead of perror for consistency with other checks already done in the garbage collector (see this for an example)

Closes #2220

Comment on lines -30 to 32
printf("Out of heap space\n");
fprintf(stderr, "Out of heap space\n");
StackTrace_PrintStackTrace();
exit(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not being printed to the stderr

@@ -23,7 +23,7 @@
#define HEAP_MEM_FD_OFFSET 0

void Heap_exitWithOutOfMemory() {
printf("Out of heap space\n");
fprintf(stderr, "Out of heap space\n");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not being printed to the stderr

@WojciechMazur WojciechMazur merged commit 8b787c2 into scala-native:master Mar 29, 2021
@ncordon ncordon deleted the better-commix-checks branch March 30, 2021 15:14
ekrich pushed a commit to ekrich/scala-native that referenced this pull request May 21, 2021
)

* Makes checks on output when doing sempahore operations

* Prints error message to stderr instead of stdout

* Uses fprintf to stderr instead of perror for consistency
WojciechMazur pushed a commit to WojciechMazur/scala-native that referenced this pull request Aug 25, 2021
)

* Makes checks on output when doing sempahore operations

* Prints error message to stderr instead of stdout

* Uses fprintf to stderr instead of perror for consistency
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

Successfully merging this pull request may close these issues.

Make commix GC more robust
2 participants