typelevel / typelevel/scalacheck

Shrinking goes into semi-infinite recursion

Open
#968 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Scala
Stars
2k
Forks
393
Avg merge
6h 42m
Merged PRs (30d)
4

Description

Here is a commit, for which IteratorExtensionSpec never ends after entering Prop.findFirstFailure: sugar.

This happens fairly often for me; here is another one

Stacktrace:

  java.lang.Thread.State: RUNNABLE
	at scala.collection.Iterator.sameElements(Iterator.scala:843)
	at scala.collection.Iterator.sameElements$(Iterator.scala:840)
	at scala.collection.AbstractIterator.sameElements(Iterator.scala:1300)
	at net.noresttherein.sugar.collections.IteratorExtensionSpec$.prop$2(IteratorExtensionSpec.scala:38)
	at net.noresttherein.sugar.collections.IteratorExtensionSpec$.$anonfun$mappingProperty$10(IteratorExtensionSpec.scala:45)
	at net.noresttherein.sugar.collections.IteratorExtensionSpec$$$Lambda$117/0x0000000801124e38.apply(Unknown Source)
	at scala.Function1.$anonfun$andThen$1(Function1.scala:87)
	at scala.Function1$$Lambda$80/0x000000080110d388.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$forAllShrink$2(Prop.scala:769)
	at org.scalacheck.Prop$$$Lambda$95/0x0000000801114d98.apply(Unknown Source)
	at org.scalacheck.Prop$.secure(Prop.scala:479)
	at org.scalacheck.Prop$.result$1(Prop.scala:769)
	at org.scalacheck.Prop$.$anonfun$forAllShrink$4(Prop.scala:778)
	at org.scalacheck.Prop$$$Lambda$234/0x000000080114ca58.apply(Unknown Source)
	at scala.collection.immutable.Stream.map(Stream.scala:173)
	at org.scalacheck.Prop$.getFirstFailure$1(Prop.scala:778)
	at org.scalacheck.Prop$.shrinker$1(Prop.scala:792)
	at org.scalacheck.Prop$.$anonfun$forAllShrink$1(Prop.scala:813)
	at org.scalacheck.Prop$$$Lambda$81/0x000000080110d740.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$apply$1(Prop.scala:309)
	at org.scalacheck.Prop$$$Lambda$17/0x000000080102a7a0.apply(Unknown Source)
	at org.scalacheck.PropFromFun.apply(Prop.scala:22)
	at org.scalacheck.Prop.$anonfun$map$1(Prop.scala:52)
	at org.scalacheck.Prop$$Lambda$106/0x000000080111ceb8.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$apply$1(Prop.scala:309)
	at org.scalacheck.Prop$$$Lambda$17/0x000000080102a7a0.apply(Unknown Source)
	at org.scalacheck.PropFromFun.apply(Prop.scala:22)
	at org.scalacheck.Prop.$anonfun$flatMap$1(Prop.scala:58)
	at org.scalacheck.Prop$$Lambda$85/0x000000080110e6e8.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$apply$1(Prop.scala:309)
	at org.scalacheck.Prop$$$Lambda$17/0x000000080102a7a0.apply(Unknown Source)
	at org.scalacheck.PropFromFun.apply(Prop.scala:22)
	at org.scalacheck.Prop.$anonfun$flatMap$1(Prop.scala:56)
	at org.scalacheck.Prop$$Lambda$85/0x000000080110e6e8.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$apply$1(Prop.scala:309)
	at org.scalacheck.Prop$$$Lambda$17/0x000000080102a7a0.apply(Unknown Source)
	at org.scalacheck.PropFromFun.apply(Prop.scala:22)
	at org.scalacheck.Prop$.$anonfun$delay$1(Prop.scala:484)
	at org.scalacheck.Prop$$$Lambda$16/0x000000080102a3e8.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$apply$1(Prop.scala:309)
	at org.scalacheck.Prop$$$Lambda$17/0x000000080102a7a0.apply(Unknown Source)
	at org.scalacheck.PropFromFun.apply(Prop.scala:22)
	at org.scalacheck.Prop.$anonfun$viewSeed$1(Prop.scala:41)
	at org.scalacheck.Prop$$Lambda$18/0x000000080102ab58.apply(Unknown Source)
	at org.scalacheck.Prop$.$anonfun$apply$1(Prop.scala:309)
	at org.scalacheck.Prop$$$Lambda$17/0x000000080102a7a0.apply(Unknown Source)
	at org.scalacheck.PropFromFun.apply(Prop.scala:22)
	at org.scalacheck.Test$.workerFun$1(Test.scala:474)
	at org.scalacheck.Test$.$anonfun$check$4(Test.scala:506)
	at org.scalacheck.Test$.$anonfun$check$4$adapted(Test.scala:506)
	at org.scalacheck.Test$$$Lambda$29/0x00000008010c27b0.apply(Unknown Source)
	at org.scalacheck.Platform$.runWorkers(Platform.scala:40)
	at org.scalacheck.Test$.check(Test.scala:506)
	at org.scalacheck.Test$.$anonfun$checkProperties$2(Test.scala:547)
	at org.scalacheck.Test$$$Lambda$28/0x00000008010c6d08.apply(Unknown Source)
	at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
	at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
	at scala.collection.mutable.ListBuffer.map(ListBuffer.scala:39)
	at org.scalacheck.Test$.checkProperties(Test.scala:538)
	at org.scalacheck.Properties.main(Properties.scala:77)
	at net.noresttherein.sugar.collections.IteratorExtensionSpec.main(IteratorExtensionSpec.scala)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the hang with test/scala/net/noresttherein/sugar/collections/IteratorExtensionSpec.scala and the linked scalacheck_bug commit, focusing on the call into Prop.findFirstFailure. Compare it with the second linked commit and use the stack trace to trace the shrinking path. Done means the property check terminates instead of entering semi-infinite recursion.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.