Skip to content

Conversation

@mrbandrews
Copy link
Contributor

Fixes #7496.

A bad ZMQ argument caused the code to create a socket but not destroy it and later in the shutdown code, zmq_destroy() hangs as a result.

This also removes a gratuitous call to the Shutdown method of ZMQNotificationInterface; the code calls the destructor right after returning, which calls Shutdown.


if (i!=notifiers.end())
{
Shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

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

NACK, this implies that the caller calls Shutdown() if return is false.

Copy link
Member

Choose a reason for hiding this comment

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

The destructor will call it, which will be invoked automatically whether Initialize returns false or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

@laanwj assuming you delete the object.. nevertheless Initialize() should be all or nothing. Removing the call to Shutdown() leaves the notification interface partially initialised.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@promag CreateWithArguments deletes the object if initialization fails

Copy link
Contributor

Choose a reason for hiding this comment

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

@mrbandrews @laanwj right, forgot Initialize() is protected. I take it back.

Copy link
Member

Choose a reason for hiding this comment

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

assuming you delete the object

Sure. But well if not that's a memory leak, and thus a bug in self.

@laanwj
Copy link
Member

laanwj commented Mar 1, 2016

utACK 0040118

@promag
Copy link
Contributor

promag commented Mar 2, 2016

utACK 0040118.

@sipa
Copy link
Member

sipa commented Mar 5, 2016

utACK

@laanwj laanwj merged commit 0040118 into bitcoin:master Mar 15, 2016
laanwj added a commit that referenced this pull request Mar 15, 2016
0040118 Fixes ZMQ startup with bad arguments. (mrbandrews)
@dcousens
Copy link
Contributor

utACK 0040118

zkbot added a commit to zcash/zcash that referenced this pull request Feb 9, 2017
zkbot added a commit to zcash/zcash that referenced this pull request Feb 9, 2017
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wrong zmq argument causes core dump or infinite loop

6 participants