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

StateVertix is not Serializable #53

Closed
alexnederlof opened this Issue Dec 4, 2012 · 0 comments

Comments

Projects
None yet
2 participants
@alexnederlof
Member

alexnederlof commented Dec 4, 2012

Original author: jellefre...@gmail.com (November 02, 2011 16:43:18)

What steps will reproduce the problem?

  1. Serialize a com.crawljax.core.state.StateVertix.

What is the expected output?
Serialization without errors/exceptions.

What do you see instead?
A NotSerializableException is thrown.

Please provide any additional information below.
A StateVertix contains a variable candidateActionsSearchLock, which is an Object to guard a critical section in the method searchForCandidateElements(), but an Object is not Serializable.

Possible solutions:

  1. Making the variable transient doesn't solve the problem, because during deserialization the variable would be set to the default value (null for objects), which leads to a NullPointerException when Java subsequently tries to acquire the lock for the critical section.

  2. Removing the variable and synchronizing the critical section on this instead of that variable probably works, but may lead to incorrect behavior if any other piece of code uses a StateVertix as a guard for a critical section.

  3. Changing the variable to a String and setting it to an empty String will work. It does not suffer from the problems of solution 1 and 2, only has a small memory footprint and doesn't require any extra lines of code.

Original issue: http://code.google.com/p/crawljax/issues/detail?id=53

@ghost ghost assigned amesbah Dec 18, 2012

avandeursen added a commit that referenced this issue Dec 19, 2012

Merge pull request #76 from crawljax/Issue-53-state-serialization
fixes issues #52 and #53, resolved typo in StateVertix -> StateVertex.

A rather large pull request, but this is simply due to correcting the typo.
Time to merge.

@amesbah amesbah closed this Dec 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment