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

avoid java.net.URL #441

Closed
wants to merge 4 commits into from
Closed

Conversation

jtjeferreira
Copy link
Contributor

I was using sbt without internet connection and noticed that update task taking a lot of time (around 30s). I did a thread dump with a SigQuit ( Ctrl + \) and noticed that the thread was blocked because java.net.URL#equals blocks:

"pool-514-thread-3" #918 prio=5 os_prio=31 cpu=292.62ms elapsed=128.20s tid=0x000000012d484a00 nid=0x1071b waiting for monitor entry  [0x0000000175550000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at java.net.InetAddress$NameServiceAddresses.get([email protected]/InetAddress.java:838)
	- waiting to lock <0x0000000737d5e758> (a java.net.InetAddress$NameServiceAddresses)
	at java.net.InetAddress.getAllByName0([email protected]/InetAddress.java:1533)
	at java.net.InetAddress.getAllByName([email protected]/InetAddress.java:1385)
	at java.net.InetAddress.getAllByName([email protected]/InetAddress.java:1306)
	at java.net.InetAddress.getByName([email protected]/InetAddress.java:1256)
	at java.net.URL.getHostAddress([email protected]/URL.java:831)
	- locked <0x00000007073fd680> (a java.net.URL)
	at java.net.URLStreamHandler.getHostAddress([email protected]/URLStreamHandler.java:447)
	at java.net.URLStreamHandler.hostsEqual([email protected]/URLStreamHandler.java:459)
	at java.net.URLStreamHandler.sameFile([email protected]/URLStreamHandler.java:431)
	at java.net.URLStreamHandler.equals([email protected]/URLStreamHandler.java:352)
	at java.net.URL.equals([email protected]/URL.java:980)
	at scala.runtime.BoxesRunTime.equals2(BoxesRunTime.java:137)
	at scala.runtime.BoxesRunTime.equals(BoxesRunTime.java:123)
	at scala.Some.equals(Option.scala:513)
	at sbt.librarymanagement.Artifact.equals(Artifact.scala:22)
	at scala.runtime.BoxesRunTime.equals2(BoxesRunTime.java:137)
	at scala.runtime.BoxesRunTime.equals(BoxesRunTime.java:123)
	at scala.Tuple2.equals(Tuple2.scala:24)
	at scala.runtime.BoxesRunTime.equals2(BoxesRunTime.java:137)
	at scala.runtime.BoxesRunTime.equals(BoxesRunTime.java:123)
	at scala.collection.IterableLike.sameElements(IterableLike.scala:304)
	at scala.collection.IterableLike.sameElements$(IterableLike.scala:294)
	at scala.collection.AbstractIterable.sameElements(Iterable.scala:56)
	at scala.collection.GenSeqLike.equals(GenSeqLike.scala:481)
	at scala.collection.GenSeqLike.equals$(GenSeqLike.scala:480)
	at scala.collection.AbstractSeq.equals(Seq.scala:45)
	at sbt.librarymanagement.ModuleReport.equals(ModuleReport.scala:34)
	at scala.runtime.BoxesRunTime.equals2(BoxesRunTime.java:137)
	at scala.runtime.BoxesRunTime.equals(BoxesRunTime.java:123)
	at scala.collection.IterableLike.sameElements(IterableLike.scala:304)
	at scala.collection.IterableLike.sameElements$(IterableLike.scala:294)
	at scala.collection.AbstractIterable.sameElements(Iterable.scala:56)
	at scala.collection.GenSeqLike.equals(GenSeqLike.scala:481)
	at scala.collection.GenSeqLike.equals$(GenSeqLike.scala:480)
	at scala.collection.AbstractSeq.equals(Seq.scala:45)
	at sbt.librarymanagement.ConfigurationReport.equals(ConfigurationReport.scala:21)

In this PR I tried to replace java.net.URL with java.net.URI in a backwards compatible manner in Artifact, Developer, and ScmInfo.

Although I managed to make mima happy, I think there is a problem in the Artifact#apply method because it changed from having a parameter url: Option[java.net.URL] to uri: Option[java.net.URI] (which erases to Option and makes mima happy). I also cant add a new backwards compatible apply method because it would erase to the same signature.

Any ideas how to move forward?

@jtjeferreira
Copy link
Contributor Author

@adpi2 I see you are working on #442. Do you think I can drop binary compatibility here?

@adpi2
Copy link
Member

adpi2 commented May 29, 2024

@adpi2 I see you are working on #442. Do you think I can drop binary compatibility here?

Yes, if you open a new PR to wip/sbt-2.x.

In sbt 1.x you should try not to break it and if you cannot, we should make sure it won't break any plugin out there.

@jtjeferreira
Copy link
Contributor Author

@adpi2 I see you are working on #442. Do you think I can drop binary compatibility here?

Yes, if you open a new PR to wip/sbt-2.x.

I will do that

if you cannot, we should make sure it won't break any plugin out there.

how can I check if the change will break other plugins? There is some kind of community build?

@jtjeferreira
Copy link
Contributor Author

@adpi2 I opened #443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants