Skip to content

Support fs2.io.readOutputStream on Scala Native#3714

Merged
armanbilge merged 5 commits into
typelevel:mainfrom
lolgab:native-readOutputStream
Apr 17, 2026
Merged

Support fs2.io.readOutputStream on Scala Native#3714
armanbilge merged 5 commits into
typelevel:mainfrom
lolgab:native-readOutputStream

Conversation

@lolgab
Copy link
Copy Markdown
Contributor

@lolgab lolgab commented Apr 11, 2026

No description provided.

@lolgab lolgab marked this pull request as ready for review April 12, 2026 07:14
@lolgab lolgab force-pushed the native-readOutputStream branch from 4236fb3 to f46cd49 Compare April 12, 2026 08:10
}
test("classloader") {
val size = readClassLoaderResource[IO]("fs2/io/foo", 8192).as(1L).compile.foldMonoid
val resourcePath = if (isNative) "/fs2/io/foo" else "fs2/io/foo"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This difference surprised me. Does the absolute path not work on the JVM?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't investigated, but I think it's a bug in Scala Native, but since it's test code I preferred to add a if here and eventually when gets fixed upstream you'll see a failing test and it's trivial to remove the if.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when gets fixed upstream you'll see a failing test

Maybe! But also it could be that both are valid, in which case there wouldn't be a failed test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I just checked, and the leading / doesn't work on the JVM. So it's a bug :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just opened a PR on Scala Native to fix the bug: scala-native/scala-native#4901

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #3728

@lolgab
Copy link
Copy Markdown
Contributor Author

lolgab commented Apr 14, 2026

Unfortunately the tests are hitting timeout on Scala Native, there might be something wrong with the Scala Native implementation (?).

Did you see this before @armanbilge?

@armanbilge
Copy link
Copy Markdown
Member

Unfortunately the tests are hitting timeout on Scala Native, there might be something wrong with the Scala Native implementation (?).

I don't think there is anything wrong per-se, I think it may just actually be timing out since it involves a very large stream and may be running a bit slowly in Scala Native. Does it pass locally if you increase the timeout?

val byteStream =
Stream
.chunk[IO, Byte](Chunk.array(("foobar" * 50000).getBytes(StandardCharsets.UTF_8)))
.repeatN(7200L) // 6 * 50,000 * 7,200 == 2,160,000,000 > 2,147,483,647 == Int.MaxValue

@armanbilge
Copy link
Copy Markdown
Member

Does it pass locally if you increase the timeout?

Seems to pass for me. So we just need to increase the timeout for CI.

@lolgab
Copy link
Copy Markdown
Contributor Author

lolgab commented Apr 17, 2026

Thank you @armanbilge, increasing the timeout indeed did fix it!

Copy link
Copy Markdown
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@armanbilge armanbilge merged commit 0124d7f into typelevel:main Apr 17, 2026
16 checks passed
@lolgab lolgab deleted the native-readOutputStream branch April 18, 2026 07:42
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