Spring-WebFlux http / 2 Undertow [Слушатель не выполняет прогресс на кадрированном канале, закрывая канал для предотвращения бесконечного цикла] - PullRequest
0 голосов
/ 31 мая 2019

Теперь я заново редактирую свой кейс [2019-7-12]

Я запускал кейс много раз.и я также попытался Netty , в котором код работает нормально, но в undertow, который снова и снова не работает.

окружение: jdk11, spring-webflux2.1.6, undertow / netty[по умолчанию], OKHTTP3

Кто-нибудь сталкивался с этим?

вот журнал сервера:

2019-07-12 19:53:56.827  INFO 8920 --- [           main] org.xnio                                 : XNIO version 3.3.8.Final
2019-07-12 19:53:56.832  INFO 8920 --- [           main] org.xnio.nio                             : XNIO NIO Implementation Version 3.3.8.Final
2019-07-12 19:53:56.904  INFO 8920 --- [           main] o.s.b.w.e.undertow.UndertowWebServer     : Undertow started on port(s) 9000 (https)
2019-07-12 19:53:56.907  INFO 8920 --- [           main] com.itachy.webflux.WebfluxApp            : Started WebfluxApp in 1.914 seconds (JVM running for 3.069)
2019-07-12 19:54:09.986 ERROR 8920 --- [   XNIO-1 I/O-3] io.undertow                              : UT005032: Listener not making progress on framed channel, closing channel to prevent infinite loop
2019-07-12 19:54:09.989 ERROR 8920 --- [      elastic-2] io.undertow                              : UT005085: Connection io.undertow.server.protocol.http2.Http2ServerConnection@784d0568 for exchange HttpServerExchange{ POST /hello} was not closed cleanly, forcibly closing connection
2019-07-12 19:54:10.032 ERROR 8920 --- [   XNIO-1 I/O-2] io.undertow                              : UT005032: Listener not making progress on framed channel, closing channel to prevent infinite loop

Воспроизвести код сервера:

@PostMapping({"/hello", "/hi"})
    public Flux<DataBuffer> sayHello() {

        return Flux.create(callback -> {

            Stream.of("Java", "Python", "Spring", "WebFlux")
                .map(item -> new DefaultDataBufferFactory().wrap(item.getBytes(StandardCharsets.UTF_8)))
                .forEach(callback::next);
            callback.complete();
        }).timeout(Duration.ofMillis(8000), Flux.just(new DefaultDataBufferFactory().wrap("Hello World".getBytes(StandardCharsets.UTF_8))))
            .subscribeOn(Schedulers.elastic())
            .cast(DataBuffer.class);
    }

код клиента:

public String hello() {

        Request request = new Request.Builder().url("https://localhost:9000/hello").post(new FormBody.Builder().build()).build();
        try (Response response = httpClient.newCall(request).execute()) {
            log.info("http protocol: {}", response.protocol());
            if (null != response.body()) {
                return response.body().string();
            }
        } catch (Exception e) {
            log.error("http error, detail msg: ", e);
        }
        return null;
    }
...