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

race condition in upmap causes null pointer exception #71

Open
shaunlebron opened this issue Jan 28, 2025 · 0 comments
Open

race condition in upmap causes null pointer exception #71

shaunlebron opened this issue Jan 28, 2025 · 0 comments

Comments

@shaunlebron
Copy link

shaunlebron commented Jan 28, 2025

Using upmap sometimes results in this exception:

java.lang.NullPointerException: Cannot invoke "java.util.concurrent.Future.get()" because "fut" is null
core.clj:2317	clojure.core / deref_future
core.clj:2337	clojure.core / deref
impl.clj:58	com.climate.claypoole.impl / deref_fixing_exceptions
impl.clj:58	com.climate.claypoole.impl / deref_fixing_exceptions

It appears that pmap-core zips the ordered tasks with an unordered queue of derefable results of those tasks, and sometimes the second value (returned by a blocking take from the unordered queue) returns nil, causing deref-fixing-exceptions to deref that nil value, throwing the above exception.

So, something in the implementation of the blocking take from the unordered queue is causing it to return nil. I can only guess this is a race condition because it seemed to happen randomly. Anecdotally, I saw it happening more in 1.1.4 than in 1.2.2.

I don’t have steps to reproduce, but we fixed the issue in our system by just switching from upmap to pmap, which avoids what I think is the problematic zip operation above.

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

1 participant