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

MessageSender and ReplayableWorkItem are not thread-safe but got accessed from various threads #4

Closed
jtaubensee opened this issue Nov 1, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@jtaubensee
Copy link
Contributor

From @ialexandrov on October 21, 2016 11:32

MessageSender has set of fields which are not final. At the same time methods of MessageSender are called from different threads without any state synchronization. This will lead to ocasional phantom isssues.
Either make MessageSender thread safe or make sure all members of it are only accessed from reactor thread,

For example:
MessageSender.lastKnownLinkError is set by reactor thread in onError method and read in sendCore() method which is called from ForJoinPool due to (probably) bug in EventHubClient.send(..,) methods where thenComposeAsync is called instead on thenCompose.

More of less the same problem is with ReplayableWorkItem.lastKnownException which is again is set by reactor thread but read from timer thread pool thread:

java / azure-eventhubs / src / main / java / com / microsoft / azure / servicebus / MessageSender.java
778 MessageSender.this.throwSenderTimeout(sendData.getWork(), sendData.getLastKnownException());

Copied from original issue: Azure/azure-event-hubs#284

@jtaubensee jtaubensee changed the title JavaClient: MessageSender and ReplayableWorkItem are not thread-dase but got accessed from various threads MessageSender and ReplayableWorkItem are not thread-dase but got accessed from various threads Nov 1, 2016
@SreeramGarlapati SreeramGarlapati changed the title MessageSender and ReplayableWorkItem are not thread-dase but got accessed from various threads MessageSender and ReplayableWorkItem are not thread-safe but got accessed from various threads Jan 9, 2017
@jtaubensee jtaubensee added the bug label Feb 24, 2017
SreeramGarlapati added a commit to SreeramGarlapati/azure-event-hubs-java that referenced this issue Apr 5, 2017
* use non ForkJoinPool variants while composing completable futures (Azure#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(Azure#4)
SreeramGarlapati added a commit to SreeramGarlapati/azure-event-hubs-java that referenced this issue Apr 5, 2017
…ceiver (#5)

* fix connection open/close timeout paths
* use non ForkJoinPool variants while composing completable futures (Azure#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(Azure#4)
SreeramGarlapati added a commit to SreeramGarlapati/azure-event-hubs-java that referenced this issue Apr 6, 2017
…ceiver

* fix connection open/close timeout paths
* use non ForkJoinPool variants while composing completable futures (Azure#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(Azure#4)
@SreeramGarlapati
Copy link
Contributor

SreeramGarlapati commented Apr 6, 2017

@ialexandrov

  • thanks a lot for the great/valuable suggestion.
    You are first one (and infact the only one so far) to understand the threading model of eventhubs javaclient without me explaining it :) - this awe'd me.

Please see if you can review the PR #93 which is the last round to address all the feedback you provided (sorry about the delay)...

hmlam pushed a commit that referenced this issue Apr 6, 2017
…ceiver (#93)

* fix connection open/close timeout paths
* use non ForkJoinPool variants while composing completable futures (#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(#4)
SreeramGarlapati added a commit to SreeramGarlapati/azure-event-hubs-java that referenced this issue Apr 6, 2017
…ceiver (Azure#93)

* fix connection open/close timeout paths
* use non ForkJoinPool variants while composing completable futures (Azure#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(Azure#4)
@jtaubensee jtaubensee added this to the 0.13.1 milestone Apr 7, 2017
@jtaubensee
Copy link
Contributor Author

Closing based on PR #93

Jgomez13 pushed a commit that referenced this issue May 17, 2024
…ceiver (#93)

* fix connection open/close timeout paths
* use non ForkJoinPool variants while composing completable futures (#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(#4)
Jgomez13 pushed a commit that referenced this issue May 17, 2024
…ceiver (#93)

* fix connection open/close timeout paths
* use non ForkJoinPool variants while composing completable futures (#4)
* fix thread-safety in MessageSender & MessageReceiver in error cases(#4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants