Skip to content
This repository was archived by the owner on Aug 23, 2020. It is now read-only.

zmq: only write to socket from one thread#569

Merged
GalRogozinski merged 3 commits intoiotaledger-archive:devfrom
th0br0:fix-zmq-ioob
Mar 6, 2018
Merged

zmq: only write to socket from one thread#569
GalRogozinski merged 3 commits intoiotaledger-archive:devfrom
th0br0:fix-zmq-ioob

Conversation

@th0br0
Copy link
Copy Markdown
Contributor

@th0br0 th0br0 commented Mar 5, 2018

zeromq is not thread safe to use.
Hence, the Socket should only be used from within one thread.

@th0br0 th0br0 requested review from GalRogozinski and alon-e March 5, 2018 14:07
@th0br0
Copy link
Copy Markdown
Contributor Author

th0br0 commented Mar 5, 2018

Both internal & community users reported no more ZMQ outages.

Copy link
Copy Markdown
Contributor

@GalRogozinski GalRogozinski left a comment

Choose a reason for hiding this comment

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

Use a log please

try {
publisherService.awaitTermination(5, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be printed with a logger?

} catch (InterruptedException e) {
e.printStackTrace();
}
publisher.close();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since there is a try I find it more readable to put the last two lines in a finally block.

@GalRogozinski GalRogozinski merged commit 2f1fb78 into iotaledger-archive:dev Mar 6, 2018
@alon-e alon-e mentioned this pull request Apr 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants