Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SocketChannelPool bug #360

Closed
taotao365s opened this issue Aug 8, 2017 · 0 comments
Closed

SocketChannelPool bug #360

taotao365s opened this issue Aug 8, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@taotao365s
Copy link

taotao365s commented Aug 8, 2017

运行日志,请关注最后一行

2017-08-08 09:59:07.224 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv4Stack: false
2017-08-08 09:59:07.224 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.util.NetUtil - -Djava.net.preferIPv6Addresses: false
2017-08-08 09:59:07.313 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.util.NetUtil - Loopback interface: lo (Software Loopback Interface 1, 127.0.0.1)
2017-08-08 09:59:07.317 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.util.NetUtil - \proc\sys\net\core\somaxconn: 200 (non-existent)
2017-08-08 09:59:07.403 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.channel.DefaultChannelId - -Dio.netty.machineId: 00:00:00:00:00:00:00:e0 (auto-detected)
2017-08-08 09:59:07.404 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.util.internal.ThreadLocalRandom - -Dio.netty.initialSeedUniquifier: 0xfe50d10b389fdd4b
2017-08-08 09:59:07.482 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.allocator.type: pooled
2017-08-08 09:59:07.483 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.threadLocalDirectBufferSize: 65536
2017-08-08 09:59:07.483 [destination = example , address = /127.0.0.1:3306 , EventParser] DEBUG io.netty.buffer.ByteBufUtil - -Dio.netty.maxThreadLocalCharBufferSize: 16384
2017-08-08 09:59:17.547 [destination = example , address = /127.0.0.1:3306 , EventParser] INFO  c.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - connect MysqlConnection to /127.0.0.1:3306...
public static SocketChannel open(SocketAddress address) throws Exception {
        final SocketChannel socket = new SocketChannel();
        boot.connect(address).addListener(new ChannelFutureListener() {

            @Override
            public void operationComplete(ChannelFuture arg0) throws Exception {
                if (arg0.isSuccess()) socket.setChannel(arg0.channel());
                synchronized (socket) {
                    socket.notify();    // <--------------------
                }
            }
        });
        synchronized (socket) {
            socket.wait();  // <--------------------
        }
        if (null == socket.getChannel()) {
            throw new IOException("can't create socket!");
        }
        chManager.put(socket.getChannel(), socket);
        return socket;
    }

notify是有可能会比wait提前执行的,建议优化下

agapple added a commit that referenced this issue Sep 23, 2017
@agapple agapple self-assigned this Oct 16, 2017
@agapple agapple added the bug label Oct 16, 2017
@agapple agapple added this to the v1.0.25 milestone Oct 16, 2017
@agapple agapple closed this as completed Oct 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants