HTTP server on Loom

Jan Kasarda jano.kasarda at gmail.com
Wed Dec 1 08:28:29 UTC 2021


Hi,

I am trying to implement some basic HTTP server on Loom (windows binary
downloaded from EA). More or less it works as expected. But there is a
unexpected thing (which may come from my not understanding current
limitations of Loom):

Just starting Java's HTTP server on port 80 with a simple handler sending
http code 200 is enough to demonstrate the problem. Simple curl call to
http://localhost:80 works as expected. In case the URL is changed to https
server gets blocked. It just hangs. After this call no more calls are
processed. Not even http onces.

Since this behavior manifests itself only on executor with virtual thread
factory I am reaching for help here. (In case line with executor in code
below is commented out this problem is not happening.)

Is there something I can't see and this is expected

Thanks,
Pokusak

import com.sun.net.httpserver.HttpServer;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;

public class Main {

public static void main(String[] args) throws Exception {
  HttpServer server = HttpServer.create(new InetSocketAddress("localhost",
80), 0);

server.setExecutor(Executors.newThreadPerTaskExecutor(Thread.ofVirtual().factory()));
  server.createContext("/", exchange -> exchange.sendResponseHeaders(200,
-1));
  server.start();
 }
}


More information about the loom-dev mailing list