Persistent assoc/conj on a transient-created collision node

Description

Bug reported by Zach Tellman https://groups.google.com/d/msg/clojure-dev/HvppNjEH5Qc/1wZ-6qE7nWgJ

Since transients were introduced the invariant array.length == count*2 doesn't hold for HashCollisionNode.
However persistent .without still relies on it.

Hence persistent dissoc on a collision node created by transients fails.

returns false.

Patch: persistent-assoc-after-collision.diff

Generative test patch: transient-generative-test.diff

The generative test reliably reproduces the error. It is simpler than the original test that found the bug but tests a series conj/disj/transient/persistent actions on a set. I've included it separately in case we decide not to apply.

Screened by: Alex Miller

Environment

None

Attachments

2

Activity

Show:

Alex Miller November 11, 2013 at 5:17 PM

Patch was applied to master for 1.6.

Alex Miller November 4, 2013 at 4:40 AM

Added a simplified version of a test-generative test and marked screened.

Alex Miller November 1, 2013 at 1:35 PM

I'm going to take a crack at repro with test.generative this morning - wish me luck!

Michał Marczyk November 1, 2013 at 11:19 AM

Just wanted to note that this patch, apart from preventing the hash-based collections from failing Zach's test suite, also makes avl.clj collections pass (now that I've released fixes for the two bugs uncovered by the test suite in avl.clj 0.0.9). This provides some cross-validation, I think.

(The built-in sorted collections pass either way, because they don't support transient ops.)

Also, David Nolen has merged the ClojureScript port of the patch.

Andy Fingerhut October 31, 2013 at 4:52 PM

Alex, I suspect clojure-dev would reach a much wider audience for your request than a comment on this ticket, which only has 3 watchers, and I don't think many people besides you and I watch the stream of all ticket state changes as they go by.

Completed

Details

Assignee

Reporter

Labels

Approval

Ok

Patch

Code and Test

Priority

Affects versions

Fix versions

Created October 28, 2013 at 11:17 AM
Updated November 11, 2013 at 5:17 PM
Resolved November 11, 2013 at 5:17 PM