ipfs-shipyard / java-ipfs-http-client

A Java implementation of the HTTP IPFS API
MIT License
538 stars 243 forks source link

when i use pubsub shutdown ipfs will bug #228

Open vyouzhis opened 1 year ago

vyouzhis commented 1 year ago

nohup ipfs daemon --enable-pubsub-experiment --enable-namesys-pubsub > nohup.out

root@4b49ea53b543:~# cat nohup.out Initializing daemon... Kubo version: 0.18.1 Repo version: 13 System version: amd64/linux Golang version: go1.19.1 2023-05-04T06:33:14.126Z ERROR cmd/ipfs ipfs/daemon.go:406 Private networking (swarm.key / LIBP2P_FORCE_PNET) does not work with public HTTP IPNIs enabled by Routing.Type=auto. Kubo will use Routing.Type=dht instead. Update config to remove this message. go-libp2p resource manager protection disabled Swarm is limited to private network of peers with the swarm key Swarm key fingerprint: 5563f4bb81734cca734ff7565b478edb Swarm listening on /ip4/127.0.0.1/tcp/4001 Swarm listening on /ip4/127.0.0.1/tcp/4003/ws Swarm listening on /ip4/172.17.0.3/tcp/4001 Swarm listening on /ip4/172.17.0.3/tcp/4003/ws Swarm listening on /p2p-circuit Swarm announcing /ip4/127.0.0.1/tcp/4001 Swarm announcing /ip4/127.0.0.1/tcp/4003/ws Swarm announcing /ip4/172.17.0.3/tcp/4001 Swarm announcing /ip4/172.17.0.3/tcp/4003/ws API server listening on /ip4/0.0.0.0/tcp/5001 WebUI: http://0.0.0.0:5001/webui Gateway (readonly) server listening on /ip4/0.0.0.0/tcp/8080 Daemon is ready 2023-05-04T06:33:46.039Z ERROR swarm2 swarm/swarm.go:215 error when shutting down listener: close tcp4 0.0.0.0:4003: use of closed network connection 2023-05-04T06:34:14.161Z ERROR cmd/ipfs ipfs/daemon.go:588 failed to access config: cannot access config, repo not open panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x1a8 pc=0x21339b7]

goroutine 838 [running]: main.daemonFunc.func7() github.com/ipfs/kubo@v0.18.1/cmd/ipfs/daemon.go:590 +0xb7 created by time.goFunc time/sleep.go:176 +0x32

`public static void main(String[] args) {

test();

}

private static void test() { IPFS _ipfs = new IPFS("ip...", 5001);
String topic = "uL3JlY29yZC9MMmx3Ym5NdkFDUUlBUklnZk5RSjdHS0xGN2tBeU9XVzh4dHg2NG16SC1CdUlWazdrQUhwTDhsdXdpOA"; Consumer<Map<String, Object>> results = new Consumer<Map<String,Object>>() {

    @Override
    public void accept(Map<String, Object> arg0) {
        // TODO Auto-generated method stub
        System.out.println(arg0);

    }

};
Consumer<IOException> error = new Consumer<IOException>() {

    @Override
    public void accept(IOException arg0) {
        // TODO Auto-generated method stub
        System.out.println(arg0);
        throw new UnsupportedOperationException("Unimplemented method 'accept'");
    }

};
ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(1);
executor.submit(() -> {
    try {
        _ipfs.pubsub.sub(topic, results, error);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
});

try {
    Thread.sleep(10000);
} catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
System.out.println("shutdown");
try {
    _ipfs.shutdown();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

}`

vyouzhis commented 1 year ago

oh, yeah, i guess the err can i add any code in here

image