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

NullPointerException upon writing error response #10014

Closed
remcowesterhoud opened this issue Aug 5, 2022 · 4 comments · Fixed by #10026 or #10037
Closed

NullPointerException upon writing error response #10014

remcowesterhoud opened this issue Aug 5, 2022 · 4 comments · Fixed by #10026 or #10037
Assignees
Labels
kind/bug Categorizes an issue or PR as a bug scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/high Marks a bug as having a noticeable impact on the user with no known workaround version:8.1.0-alpha5 Marks an issue as being completely or in parts released in 8.1.0-alpha5 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0

Comments

@remcowesterhoud
Copy link
Contributor

Describe the bug

The ErrorResponseWriter tried to write an error response, but the errorCode was null.

To Reproduce

I don't know

Expected behavior

No NPE is thrown.

Log/Stacktrace

https://console.cloud.google.com/errors/detail/CNr_jurZ9ZLCzAE;service=zeebe;time=P7D?project=camunda-cloud-240911

Full Stacktrace

 java.lang.NullPointerException: error code
	at java.util.Objects.requireNonNull(Unknown Source) ~[?:?]
	at io.camunda.zeebe.util.EnsureUtil.ensureNotNull(EnsureUtil.java:20) ~[zeebe-util-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.broker.transport.ErrorResponseWriter.tryWriteResponse(ErrorResponseWriter.java:161) ~[zeebe-broker-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.broker.transport.AsyncApiRequestHandler.lambda$handleRequest$1(AsyncApiRequestHandler.java:114) ~[zeebe-broker-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.future.FutureContinuationRunnable.run(FutureContinuationRunnable.java:28) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.ActorJob.invoke(ActorJob.java:94) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.ActorJob.execute(ActorJob.java:45) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.ActorTask.execute(ActorTask.java:119) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.ActorThread.executeCurrentTask(ActorThread.java:106) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.ActorThread.doWork(ActorThread.java:87) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT]
	at io.camunda.zeebe.scheduler.ActorThread.run(ActorThread.java:198) ~[zeebe-scheduler-8.1.0-SNAPSHOT.jar:8.1.0-SNAPSHOT] 

Environment:

  • Zeebe Version: latest SNAPSHOT
@remcowesterhoud remcowesterhoud added the kind/bug Categorizes an issue or PR as a bug label Aug 5, 2022
@remcowesterhoud
Copy link
Contributor Author

@oleschoenburg I'm a bit swarmed currently so I didn't do a very deep dive into this NPE. What I quickly saw is that it originates from the AsyncApiRequestHandler. It seems like you've created this a few days ago. Maybe you can have a quick look if you already see something wrong.

@oleschoenburg
Copy link
Member

AsyncApiRequestHandler is mostly a rename, it existed before as ApiRequestHandler.

Looks like the command api handler returned the error writer but didn't set a error code, which should not be possible 😬

@oleschoenburg
Copy link
Member

Yikes, looks like I made a mess out of AsyncApiRequestHandler 🤦

We are re-using the readers and writers which is not safe since handlers are async.

@oleschoenburg oleschoenburg added scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/high Marks a bug as having a noticeable impact on the user with no known workaround labels Aug 5, 2022
@oleschoenburg oleschoenburg self-assigned this Aug 5, 2022
@pihme
Copy link
Contributor

pihme commented Aug 9, 2022

@pihme pihme reopened this Aug 9, 2022
zeebe-bors-camunda bot added a commit that referenced this issue Aug 9, 2022
10037: fix: create new readers and writer for every sync request r=oleschoenburg a=oleschoenburg

## Description

Applies the fix in #10026 for sync api handlers too.

Due to our actor scheduler, even sync handlers can't reuse readers andwriters because `onComplete` on the already completed future doesn't run immediately, causing a data race on the readers and writers when handling concurrent requests.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10014 



Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
zeebe-bors-camunda bot added a commit that referenced this issue Aug 9, 2022
10037: fix: create new readers and writer for every sync request r=oleschoenburg a=oleschoenburg

## Description

Applies the fix in #10026 for sync api handlers too.

Due to our actor scheduler, even sync handlers can't reuse readers andwriters because `onComplete` on the already completed future doesn't run immediately, causing a data race on the readers and writers when handling concurrent requests.

## Related issues

<!-- Which issues are closed by this PR or are related -->

closes #10014 



Co-authored-by: Ole Schönburg <ole.schoenburg@gmail.com>
@Zelldon Zelldon added the version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0 label Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes an issue or PR as a bug scope/broker Marks an issue or PR to appear in the broker section of the changelog severity/high Marks a bug as having a noticeable impact on the user with no known workaround version:8.1.0-alpha5 Marks an issue as being completely or in parts released in 8.1.0-alpha5 version:8.1.0 Marks an issue as being completely or in parts released in 8.1.0
Projects
None yet
5 participants