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

Threads fail silently on error #153

Open
efaulhaber opened this issue Dec 30, 2024 · 2 comments
Open

Threads fail silently on error #153

efaulhaber opened this issue Dec 30, 2024 · 2 comments

Comments

@efaulhaber
Copy link

MWE:

julia> x = zeros(Int, 5, 10)
5×10 Matrix{Int64}:
 0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0

julia> @batch for j in axes(x, 2)
           for i in 1:5
               if i > 3 && j in (2, 4, 9)
                   error("some error")
               end
               x[i, j] = 1
           end
       end

julia> x
5×10 Matrix{Int64}:
 1  1  1  1  1  1  1  1  1  1
 1  1  1  1  1  1  1  1  1  1
 1  1  1  1  1  1  1  1  1  1
 1  0  1  0  1  1  1  1  0  1
 1  0  1  0  1  1  1  1  0  1

I want to update the columns of x and run into an error. Instead of showing the error, the relevant threads just stop silently.
In an actual code, I might want to update some object, which failed for some reason. But Polyester.jl doesn't tell me it failed, so I might continue with this broken x, not realizing it is in an invalid (incompletely updated) state, causing unpredicted behavior down the road.

@chriselrod
Copy link
Member

chriselrod commented Dec 31, 2024

wait is defined here, returning true if there was an error, and false otherwise:
https://github.com/JuliaSIMD/ThreadingUtilities.jl/blob/284d17aab09a3919759045995955d4090d5e183d/src/threadtasks.jl#L70-L92

wait is called here without checking:

ThreadingUtilities.wait(tid)

To actually print the task, you'd have to update the code in ThreadingUtilities.checktask.
checktask isn't inlined, so making it bigger by adding printing code shouldn't be a big deal.

@efaulhaber
Copy link
Author

I gave it a shot in JuliaSIMD/ThreadingUtilities.jl#54 and #154.

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

No branches or pull requests

2 participants