Skip to content

Conversation

@sternj
Copy link
Collaborator

@sternj sternj commented Aug 31, 2025

Fixed user timer being disabled after it "rings" instead of being reset

# restarted properly. It checks whether the program
# halts or runs forever, not for correctness of timing.
- name: signal smoketest
run: python test/smoketest.py test/signal_test.py
Copy link
Member

Choose a reason for hiding this comment

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

This is a bad failure case, plus we have a regression test suite in tests/. Make it a pytest and put it in that directory so it gets run in that workflow, but with a timeout for failure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the failure case is the right one-- the behaviors this patch was in response to were the signal not being delivered for whatever reason and this test checks for progress.

I'll put it in the tests workflow, I actually think it makes sense as a task with a timeout rather than as a pytest though, unless you wanted to start making pytests that spawn new processes (which it doesn't seem like we do at the moment, the pytest suite seems to be mostly unit tests). I do think it's structurally more similar to the smoketests, since we're just checking "are the signals delivered and does it create a profile with any data in it", but that's your call

Copy link
Member

Choose a reason for hiding this comment

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

I mean that the CI will get hung up - no idea what the timeout is for that thing - so the latter suggestion works.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The timeout of the CI is 15 minutes and I put in a timeout of 30 seconds for the task I created, where would the hangup happen?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also the smoketests worked fine, I could make sure the timeout works as expected but I trust the timeout-minutes directive to do the right thing

to_wait = min(remaining_time, next_interval)
else:
to_wait = next_interval
Scalene.client_timer.reset()
Copy link
Member

Choose a reason for hiding this comment

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

This works but I still get the warning about the signal, so we need to filter that.

WARNING: Scalene uses Alarm clock: 14 to profile.
If your code raises Alarm clock: 14 from non-Python code, use SIGUSR1.
Code that raises signals from within Python code will be rerouted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is desired behavior-- we put in that warning because we're changing the behavior in a way transparent when you're doing Python-only stuff, but if someone was using a C extension module that raised SIGALRM their code would break in weird ways.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I follow. This warning comes from when the signal is set in Python-land (in scalene/replacement_signal_fns.py). It wouldn't be seen by C code that didn't invoke Python.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right-- we print the warning because, while we can transparently redirect everything in Python-land, we want to warn the user in case they're doing something in C-land

@emeryberger
Copy link
Member

I'm going to merge; we can address the testing question later.

@emeryberger emeryberger merged commit 30df5e6 into master Sep 1, 2025
34 checks passed
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.

3 participants