-
Notifications
You must be signed in to change notification settings - Fork 614
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
run Process#waitFor
on virtual thread if available
#3539
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks for opening the PR, this is the right approach!
io/jvm-native/src/main/scala/fs2/io/process/ProcessesPlatform.scala
Outdated
Show resolved
Hide resolved
io/jvm-native/src/main/scala/fs2/io/process/ProcessesPlatform.scala
Outdated
Show resolved
Hide resolved
io/jvm-native/src/main/scala/fs2/io/process/ProcessesPlatform.scala
Outdated
Show resolved
Hide resolved
@armanbilge I think native test suites crash due to not being able to find |
That's correct, reflection is not supported on Scala Native.
We should move this code out of |
@armanbilge If I understand correctly, this means we need two |
Well, that's one possible way ... but I think we should just move all this stuff into a different file, that's already split for the 3 platforms (JVM/JS/Native). For example, we can add a method to def evalOnVirtualThreadIfAvailable[F[_], A](fa: F[A]): F[A] On the JVM, we can move it onto the VT executor if on JDK >= 21. On Native, we can do nothing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! One last change, we should make sure we test the Virtual Threads in CI using Java 21 (run sbt githubWorkflowGenerate
to update the CI workflow):
Line 18 in 29d6876
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17")) |
Process.waitFor
on virtual thread if availableProcess#waitFor
on virtual thread if available
@armanbilge I run |
@onsah good investigation! Yes, I think we should switch to |
@armanbilge seems like there is a bug in one of the scalafix rules that causes a test to fail. Seems like irrelevant to the changes on this PR. Is it a general issue? |
@onsah the problem is that now that we added JDK 21 to the CI, the scalafix had not been updated in a while and was not working. I tried a bit too hard to fix it in your PR (updating versions, fixing the test suite, but now we still needother changes) ... I'm sorry, we should have just resolved in a separate PR 😅 In anycase, it's not a "bug" per se, just some changes we need to make as part of the version update. Feel free to open another PR if you want to give that a try, otherwise I will try to fix it soon. |
Thank you! I checked the scalafix PR. As soon as it's merged I can rebase this PR. |
there you go, it's merged :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, this looks good to me!
Thanks @armanbilge! Who can merge it? I don't see any button to do it myself. |
@onsah I'll give a little time in case anybody else wants to review, otherwise I will merge in the next day or two :) Btw, I just realized, we can also use virtual threads for the JDK unix sockets implementation:
|
@armanbilge I will check this in the meantime, if it's already merged I can prepare a separate PR. |
Run
Process.waitFor
in virtual thread if possible to solve #3182I am not sure if this is the correct approach but I wanted to share my progress to get fast feedback.