Skip to content

soReusePort socket option fails on windows #764

@ondrejhavelka

Description

@ondrejhavelka

Describe the bug

On Windows, the blaze server wants to set the SO_REUSEPORT socket options which is not available and it fails when the server accepts a request and sets the sockets options on sun.nio.ch.SocketChannelImpl#setOption

The bug was introduced within #607

To Reproduce

Run the server on any windows machine and make a request

Additional context

java.lang.UnsupportedOperationException: 'SO_REUSEPORT' not supported
	at java.base/sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:215)
	at org.http4s.blaze.channel.nio1.NIO1ClientChannel.$anonfun$configureOptions$1(NIO1ClientChannel.scala:48)
	at scala.collection.immutable.Vector.foreach(Vector.scala:1856)
	at org.http4s.blaze.channel.nio1.NIO1ClientChannel.configureOptions(NIO1ClientChannel.scala:47)
	at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup.org$http4s$blaze$channel$nio1$NIO1SocketServerGroup$$handleClientChannel(NIO1SocketServerGroup.scala:302)
	at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup$SocketAcceptor.acceptNewConnections(NIO1SocketServerGroup.scala:181)
	at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup$SocketAcceptor.opsReady(NIO1SocketServerGroup.scala:150)
	at org.http4s.blaze.channel.nio1.SelectorLoop.processKeys(SelectorLoop.scala:195)
	at org.http4s.blaze.channel.nio1.SelectorLoop.org$http4s$blaze$channel$nio1$SelectorLoop$$runLoop(SelectorLoop.scala:165)
	at org.http4s.blaze.channel.nio1.SelectorLoop$$anon$1.run(SelectorLoop.scala:59)
	at java.base/java.lang.Thread.run(Thread.java:829)```

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions