Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Potential for race condition in signing.java #63

Open
paulhandy opened this issue Nov 13, 2017 · 1 comment
Open

Potential for race condition in signing.java #63

paulhandy opened this issue Nov 13, 2017 · 1 comment
Assignees

Comments

@paulhandy
Copy link
Contributor

The signing class keeps and uses an instance of an ICurl, but member functions are not synchronized. See here:
https://github.com/iotaledger/iota.lib.java/blob/fbacc5ae44e246b8361be3586ac6c0d28b6aac2f/jota/src/main/java/jota/utils/Signing.java#L32

For the most minimal change, I suggest to not keep an instance of an ICurl in this class - but, at the very least, change this to a SpongeFactory mode, and create an instance inside each method that uses it.

@githubdevcode
Copy link
Contributor

githubdevcode commented Dec 11, 2017

There are multiple calls to the curl object in this class, in every method its state is reseted. By one hand we can have one object and reuse it in the whole class; by the other hand we can have multiple object instances so that increasing the amount of memory consumed.

I can see a "livelock" problem here which is a kind of race condition problem. A Livelock problem happens when two or more threads are trying to complete a task over an object (state in this object to be more accurately) and they modify it altering the assumptions of the other thread on that object, this causes the non-finishing of the task by one thread or an anomalous execution finishing.

My advice is calling the SpongeFactory class every time an ICurl object is invoked in the Signing class.

githubdevcode added a commit to githubdevcode/iota.lib.java that referenced this issue Dec 11, 2017
"iotaledger#63 Potential for race condition in signing.java". The changes are related
to a problem of race condition in Signing class when using the object
of type ICurl.
pinpong added a commit that referenced this issue Dec 13, 2017
…tion_signing_63

Issue: "#63 Potential for race condition in signing.java"
frohal pushed a commit to frohal/iota.lib.java that referenced this issue Dec 24, 2017
"iotaledger#63 Potential for race condition in signing.java". The changes are related
to a problem of race condition in Signing class when using the object
of type ICurl.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants