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

[Java client] Consumer#receive returns null in case of InterruptedException and does not reset Thread.interrupted flag #9921

Closed
eolivelli opened this issue Mar 16, 2021 · 4 comments · Fixed by #10163
Labels
lifecycle/stale type/bug The PR fixed a bug or issue reported a bug

Comments

@eolivelli
Copy link
Contributor

Describe the bug
if you execute Consumer#receive() and thread is Interrupted the method returns a null value but it does not set Thread.currentThead().interrupt().
This way the caller is not aware of the Interrupted status of the Thread and cannot deal with this situation appropriately.

Expected behavior
Returning null is fine, but we must set Thread.currentThread.interrupt() and also document this behaviour in the javadocs

@eolivelli
Copy link
Contributor Author

@merlimat this problem is related to #852

IMO we should add Thread.currentThread.interrupt() after catching InterruptedException

lhotari added a commit to lhotari/nosqlbench that referenced this issue Nov 11, 2021
- see apache/pulsar#12456 for details.
  - the bug applies to the use of receiveAsync and the workaround
    is to avoid the use of receiveAsync until the fix is included in the client
- receiveAsync was introduced previously to workaround the bug apache/pulsar#9921
  - that issue isn't critical
@codelipenghui
Copy link
Contributor

The issue had no activity for 30 days, mark with Stale label.

@tisonkun
Copy link
Member

tisonkun commented Dec 9, 2022

I've updated #10163 to a mergable status. But it seems that we don't return null in this case anymore. Please check if it's still a valid issue @eolivelli .

@tisonkun
Copy link
Member

tisonkun commented Dec 9, 2022

Well. I can see we return null in internalReceive(long timeout, TimeUnit unit) and internalBatchReceive() but not internalReceive(). Weird..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
3 participants