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

Apply recent API changes #679

Merged
1 commit merged into from
Mar 3, 2023
Merged

Apply recent API changes #679

1 commit merged into from
Mar 3, 2023

Conversation

ChrisKujawa
Copy link
Member

Description

Return type is not necessary, since return was always true, which is why it has been removed from the API.

Related issues

Related to changes made here camunda/camunda@b4e0e05

Definition of Done

Not all items need to be done depending on the issue and the pull request.

Code changes:

  • The changes are backwards compatibility with previous versions
  • If it fixes a bug then PRs are created to backport the fix

Testing:

  • There are unit/integration tests that verify all acceptance criterias of the issue
  • New tests are written to ensure backwards compatibility with further versions
  • The behavior is tested manually

Documentation:

  • Javadoc has been written
  • The documentation is updated

Return type is not necessary, since return was always true, which is why it has been removed from the API.
@github-actions
Copy link

github-actions bot commented Mar 2, 2023

Test Results

  47 files  ±0    47 suites  ±0   2m 4s ⏱️ - 1m 10s
117 tests ±0  116 ✔️ ±0  1 💤 ±0  0 ±0 
374 runs  ±0  371 ✔️ ±0  3 💤 ±0  0 ±0 

Results for commit bb4ba14. ± Comparison against base commit 5bc5b7f.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@remcowesterhoud remcowesterhoud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zelldon It seems there are some failing tests. I dug a bit into it and found out that there could be multiple pendingResponses for a single request.
image

This is unexpected to me, would you agree?

@remcowesterhoud
Copy link
Contributor

remcowesterhoud commented Mar 2, 2023

Maybe to explain why the tests are failing. We are keeping track of a map of requests

  Long registerNewRequest(
      final Class<? extends GeneratedMessageV3> requestType,
      final StreamObserver<?> responseObserver) {
    final long currentRequestId = requestIdGenerator.incrementAndGet();
    requestMap.put(currentRequestId, new Request(requestType, responseObserver));
    return currentRequestId;
  }

When a response is written we remove the request from this map and send the response to the client

  @Override
  public void tryWriteResponse(final int requestStreamId, final long requestId) {
    if (rejectionType != RejectionType.NULL_VAL) {
      final Status rejectionResponse =
          responseMapper.createRejectionResponse(rejectionType, intent, rejectionReason);
      final Request request = gatewayRequestStore.removeRequest(requestId);
      sendError(request, rejectionResponse);
      return;
    }

    try {
      final Request request = gatewayRequestStore.removeRequest(requestId);
      final GeneratedMessageV3 response =
          responseMapper.map(request.requestType(), valueBufferView, key, intent);
      sendResponse(request, response);
    } catch (final Exception e) {
      throw new RuntimeException(e);
    }
  }

Since there is multiple responses for a single request we run into an NPE. We could fix it by not sending a response if we can't find the corresponding request. But I'd like to make sure this isn't a bug in Zeebe.

@ChrisKujawa
Copy link
Member Author

@remcowesterhoud I think it is a bug in zeebe. https://github.com/camunda/zeebe/blob/main/stream-platform/src/main/java/io/camunda/zeebe/stream/impl/ProcessingStateMachine.java#L356

It is not really problematic, since the response is not sent twice if it was already sent, but yeah something which we should clean up.

I guess we should use a hashset instead of a list in the ProcessingStateMachine \cc @oleschoenburg

@ChrisKujawa
Copy link
Member Author

Thanks for @remcowesterhoud checking the failures. I'm currently on FTO so have not time to fix it today.

@lenaschoenburg
Copy link
Member

Fix is prepared: camunda/camunda#11892, I guess we can merge this tomorrow.

@ChrisKujawa
Copy link
Member Author

Thanks to @oleschoenburg the CI is green again, I have rerun the jobs @remcowesterhoud I think we can merge it now.

Copy link
Contributor

@remcowesterhoud remcowesterhoud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks both!

bors merge

@ghost
Copy link

ghost commented Mar 3, 2023

Build succeeded:

@ghost ghost merged commit 32b3c6a into main Mar 3, 2023
@ghost ghost deleted the zell-fix-main branch March 3, 2023 09:01
This pull request was closed.
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

Successfully merging this pull request may close these issues.

3 participants