Skip to content

Instantly share code, notes, and snippets.

View normanmaurer's full-sized avatar
🤙

Norman Maurer normanmaurer

🤙
View GitHub Profile
public interface IoResultCallback {
void onSuccess();
void onError(Throwable cause);
default ChannelFutureListener asChannelFutureListener() {
// Implement me
}
static IoResultCallback noop() {
return ...;
@normanmaurer
normanmaurer / Http3Server.java
Created December 1, 2020 09:28
Http3Server on top of netty
/*
* Copyright 2020 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
17:18:23 Test Case 'ChannelTests.testAcceptsAfterCloseDontCauseIssues' started at 2018-03-20 16:18:23.082
17:18:31 Fatal error: leaking promise created at (file: "/code/Sources/NIO/ChannelInvoker.swift", line: 183): file /code/Sources/NIO/ChannelInvoker.swift, line 183
17:18:31 Current stack trace:
17:18:31 0 libswiftCore.so 0x00007f28cd9acf90 _swift_stdlib_reportFatalErrorInFile + 221
17:18:31 1 libswiftCore.so 0x00007f28cd6b6330 closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 284
17:18:31 2 libswiftCore.so 0x00007f28cd9569a1 <unavailable> + 4155809
17:18:31 3 libswiftCore.so 0x00007f28cd96d059 <unavailable> + 4247641
17:18:31 4 libswiftCore.so 0x00007f28cd6b5c0b <unavailable> + 1399819
17:18:31 5 libswiftCore.so 0x00007f28cd8cf6b9 <unavailable> + 3602105
17:18:31 6 libswiftCore.so 0x00007f28cd90d79f <unavailable> + 38562
Total: 2304 (80.00%) samples: 36
[ 0] java.nio.DirectByteBuffer
[ 1] io.netty.channel.AbstractChannel$AbstractUnsafe.recvBufAllocHandle
[ 2] io.netty.channel.socket.nio.NioSocketChannel.doReadBytes
[ 3] io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read
[ 4] io.netty.channel.nio.NioEventLoop.processSelectedKey
[ 5] io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized
[ 6] io.netty.channel.nio.NioEventLoop.processSelectedKeys
[ 7] io.netty.channel.nio.NioEventLoop.run
[ 8] io.netty.util.concurrent.SingleThreadEventExecutor$5.run
channel.pipeline().addLast(channel.eventLoop().parent(),....);
Build netty :: build-oraclejdk9 [4.1] #789 failed (Tests failed: 472 (472 new), passed: 11867, ignored: 178)
Agent: centos6-1
Changes included: 1 change.
Change 379ac890f4dbec15d19714711f85455a12112c3f by norman_maurer (3 files): Fix reference count issue when using Http2FrameCodec / Http2MultiplexCodec with HttpServerUpgradeHandler
Motivation:
When using Http2FrameCodec / Http2MultiplexCodec with HttpServerUpgradeHandler reference count exception will be triggered.
Changes included: 1 change.
Change 0fffc844d6d4c8e196a8448a45e7ff542446f708 by norman_maurer (6 files): Only load native transport if running architecture match the compiled library architecture.
Motivation:
We should only try to load the native artifacts if the architecture we are currently running on is the same as the one the native libraries were compiled for.
Modifications:
HyperText Transfer Protocol 2
Stream: HEADERS, Stream ID: 249, Length 8
Length: 8
Type: HEADERS (1)
Flags: 0x24
.... ...0 = End Stream: False
.... .1.. = End Headers: True
.... 0... = Padded: False
..1. .... = Priority: True
00.0 ..0. = Unused: 0x00
init = function(args)
wrk.init(args)
local r = {}
for i=1,257 do r[i] = wrk.format(nil, "/plaintext") end
req = table.concat(r)
end
request = function()
package io.netty.example.http.snoop;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;
public class HttpResponseDelayHandler extends ChannelOutboundHandlerAdapter {
@Override
public void write(ChannelHandlerContext ctx, Object msg, final ChannelPromise promise) {