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

relent() not responding to Task cancellation #21

Open
jackgene opened this issue Dec 28, 2024 · 2 comments
Open

relent() not responding to Task cancellation #21

jackgene opened this issue Dec 28, 2024 · 2 comments
Assignees
Labels
api Relates to the API design bug Describes something not working as intended code quality Concerns the standard of code rather than functionality core Describes core required functionality severe Has a significant impact on many users

Comments

@jackgene
Copy link

While implementing Easy Racer scenario 10, I observe that the blocking operation does not stop during a call to relent(), even though the Task should be cancelled (it's also possible the Task isn't cancelled due to #20).

When running scenario 10, this is observed in the scenario server logs:

scenario=10 Starting blocker for PT9S
scenario=10 Load while blocking: 1.3700397720505704
scenario=10 Load while blocking: 1.264998518100065
scenario=10 Load while blocking: 1.0780863817953164
scenario=10 Load while blocking: 1.1923439332214003
scenario=10 Load while blocking: 1.0769769863439167
scenario=10 Load while blocking: 1.1826739567751585
scenario=10 Load while blocking: 1.075331353094099
scenario=10 Load while blocking: 1.2352128760466203
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.1988273946310775
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.2360186411499214
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.2094920245009237
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.0925878801141071
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.1027617390205022
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.0989857780075007
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.120940559548046
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.107064267556403
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.144906571059734
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 1.2571903950696703
scenario=10 Mean load while connected to blocker = 1.1844579721783934, Current load = 2.271601802808182
...

(Notice that the Current load remains high even when the server has signaled to the client to stop the CPU-intensive operation (the last scenario=10 Load while blocking: ... line)). The relevant part of the CPU-intensive blocking operation is implemented here.

The alternative implementation) that checks Thread.interrupted() instead of relent() works as expected:

scenario=10 Starting blocker for PT7S
scenario=10 Load while blocking: 1.3329087133111162
scenario=10 Load while blocking: 1.0710594659583226
scenario=10 Load while blocking: 1.2349962194337993
scenario=10 Load while blocking: 1.0070292810701165
scenario=10 Load while blocking: 1.0101974877449766
scenario=10 Load while blocking: 1.2001472486986922
scenario=10 Mean load while connected to blocker = 1.1427230693695039, Current load = 0.9699755765113893
scenario=10 Mean load while connected to blocker = 1.1427230693695039, Current load = 0.008141497707268016

(Notice that the Current load = drops to 0.008... almost as soon as the client receives the signal to stop)

@propensive
Copy link
Owner

Thank you! I will check, but I think the fix is quite trivial and relent() does not use the Thread.interrupted flag. I'll find out, and remind myself why I didn't use it originally.

@propensive propensive self-assigned this Dec 29, 2024
@propensive propensive added bug Describes something not working as intended code quality Concerns the standard of code rather than functionality api Relates to the API design severe Has a significant impact on many users core Describes core required functionality labels Dec 29, 2024
@jackgene
Copy link
Author

Thank you! I will check, but I think the fix is quite trivial and relent() does not use the Thread.interrupted flag. I'll find out, and remind myself why I didn't use it originally.

I figured it might be due to how the soundness.threadModels.platform version is implemented, though I haven't tested EasyRacer with platform threads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Relates to the API design bug Describes something not working as intended code quality Concerns the standard of code rather than functionality core Describes core required functionality severe Has a significant impact on many users
Projects
Status: Todo
Development

No branches or pull requests

2 participants