Skip to content
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

Calling hasNext on concatenated iterator can drop elements #8428

Closed
scabug opened this issue Mar 19, 2014 · 7 comments
Closed

Calling hasNext on concatenated iterator can drop elements #8428

scabug opened this issue Mar 19, 2014 · 7 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Mar 19, 2014

Calling hasNext on a concatenated iterator can cause whole subsequences at the front of the iterator to disappear from the final result. I've verified the bug in 2.11.0-RC1, as well as the latest nightly build (scala-2.11.0-20140303-150720-b59c3f8641). This bug did not exist in 2.10.3.

I suspect the bug was introduced in the JoinIterator (in commit scala/scala@e3ddb2d), but I haven't verified that.

In the attached example, the iterators for 4 single-element lists are concatenated, calling hasNext on the first iterator before each concatenation, and the first two elements are missing in the final iterator result.

@scabug
Copy link
Author

@scabug scabug commented Mar 19, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8428?orig=1
Reporter: Nick Vrvilo (daowen)
Affected Versions: 2.11.0-RC1, 2.11.0-RC2
Attachments:

@scabug
Copy link
Author

@scabug scabug commented Mar 20, 2014

@adriaanm said (edited on Mar 20, 2014 3:31:30 PM UTC):
Rex, I'm considering this one for inclusion in RC4 (just missed RC3...), which will be cut Friday next week.
I'll try to have a look today to diagnose,

@scabug
Copy link
Author

@scabug scabug commented Mar 20, 2014

Nick Vrvilo (daowen) said (edited on Mar 20, 2014 4:24:28 PM UTC):
I think I've isolated the issue, and I've attached a possible patch (concat_fix.diff). I generated the patch in my local directory against the 2.11.0-RC3 source, but I didn't check out the whole git tree so the patch probably needs some massaging if you want to apply it directly. Since the patch only involves one line I doubt this will be a problem.

@scabug
Copy link
Author

@scabug scabug commented Mar 20, 2014

@Ichoran said:
Thanks for the patch, Nick! Adriaan, I'll stick the patch in on Friday and verify that it works (and try to catch any remaining issues).

@scabug
Copy link
Author

@scabug scabug commented Mar 20, 2014

@retronym said (edited on Mar 20, 2014 9:02:45 PM UTC):
Crossed in the night: scala/scala#3644

@scabug
Copy link
Author

@scabug scabug commented Mar 24, 2014

@Ichoran said:
Is this still pending or is it fixed now?

@scabug
Copy link
Author

@scabug scabug commented Mar 24, 2014

@retronym said:
Thanks for the reminder. I'm currently cleaning up the binary-compat failure that is blocking the PR.

@scabug scabug closed this Mar 25, 2014
@scabug scabug added this to the 2.11.0-RC4 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants