Skip to content

strange behavior on termux #16751

@stefanwouldgo

Description

@stefanwouldgo

Bitcoind seems to run ok, but anything that communicates with it via rpc such as lnd or bitcoin-cli is very slow/blocking for a long time. bitcoin-cli is blocking while waiting for bitcoind to answer. shutting down via bitcoin-cli stop (or even ctrl-c) doesn't terminate. bitcoind can only be finally shut down via kill -9.

bitcoind behaves normally when run on the same machine using ubuntu running in proot (with standard libraries like glibc) instead of pure termux with bionic.

here's a piece of debug log when doing bitcoin-cli stop:

`2019-08-29T08:49:20Z libevent: epoll_dispatch: epoll_wait reports 1
2019-08-29T08:49:20Z libevent: event_active: 0xb83355fc (fd 10), res 2, callback 0xb6a01141
2019-08-29T08:49:20Z libevent: event_process_active: event: 0xb83355fc, EV_READ call 0xb6a01141
2019-08-29T08:49:20Z libevent: evhttp_get_request_connection: new request from 127.0.0.1:59610 on 77

2019-08-29T08:49:20Z libevent: Attempting connection to 127.0.0.1:59610

2019-08-29T08:49:20Z libevent: event_del: 0xafcea858 (fd -1), callback 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_del: 0xafcea898 (fd -1), callback 0xb69f99b5
2019-08-29T08:49:20Z libevent: event_add: event: 0xafcea898 (fd 77), EV_WRITE call 0xb69f99b5
2019-08-29T08:49:20Z libevent: Epoll ADD(4) on fd 77 okay. Old events were 0; read change was 0 (none); write change was 1 (add); close change was 0 (none)
2019-08-29T08:49:20Z libevent: event_add: event: 0xafcea858 (fd 77), EV_READ call 0xb69f98c5
2019-08-29T08:49:20Z libevent: Epoll MOD(5) on fd 77 okay. Old events were 4; read change was 1 (add); write change was 0 (none); close change was 0 (none)
2019-08-29T08:49:20Z libevent: event_del: 0xafcea898 (fd 77), callback 0xb69f99b5
2019-08-29T08:49:20Z libevent: Epoll MOD(1) on fd 77 okay. Old events were 6; read change was 0 (none); write change was 2 (del); close change was 0 (none)
2019-08-29T08:49:20Z libevent: event_add: event: 0xafcea858 (fd 77), EV_READ EV_TIMEOUT call 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_add: event 0xafcea858, timeout in 30 seconds 0 useconds, call 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_del: 0xafcea898 (fd 77), callback 0xb69f99b5
2019-08-29T08:49:20Z libevent: event_add: event: 0xafcea858 (fd 77), EV_READ EV_TIMEOUT call 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_add: event 0xafcea858, timeout in 30 seconds 0 useconds, call 0xb69f98c5
2019-08-29T08:49:20Z libevent: timeout_next: event: 0xafcea858, in 30 seconds, 0 useconds
2019-08-29T08:49:20Z libevent: epoll_dispatch: epoll_wait reports 1
2019-08-29T08:49:20Z libevent: event_active: 0xafcea858 (fd 77), res 2, callback 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_process_active: event: 0xafcea858, EV_READ call 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_add: event: 0xafcea858 (fd 77), EV_READ EV_TIMEOUT call 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_add: event 0xafcea858, timeout in 279493 seconds 881162 useconds, call 0xb69f98c5
2019-08-29T08:49:20Z libevent: evhttp_add_header: key: Host val: 127.0.0.1

2019-08-29T08:49:20Z libevent: evhttp_add_header: key: Connection val: close

2019-08-29T08:49:20Z libevent: evhttp_add_header: key: Authorization val: Basic XX...

2019-08-29T08:49:20Z libevent: evhttp_add_header: key: Content-Length val: 37
2019-08-29T08:49:20Z libevent: evhttp_read_header: checking for post data on 77

2019-08-29T08:49:20Z libevent: evhttp_get_body_length: bytes to read: 37 (in buffer 37)

2019-08-29T08:49:20Z libevent: event_del: 0xafcea858 (fd 77), callback 0xb69f98c5
2019-08-29T08:49:20Z libevent: Epoll DEL(1) on fd 77 okay. Old events were 2; read change was 2 (del); write change was 0 (none); close change was 0 (none)
2019-08-29T08:49:20Z libevent: event_del: 0xafcea858 (fd 77), callback 0xb69f98c5
2019-08-29T08:49:20Z libevent: event_del: 0xafcea858 (fd 77), callback 0xb69f98c5
2019-08-29T08:49:20Z Received a POST request for / from 127.0.0.1:59610
2019-08-29T08:49:20Z ThreadRPCServer method=stop user=cookie
2019-08-29T08:49:20Z libevent: evhttp_add_header: key: Content-Type val: application/json

2019-08-29T08:49:20Z libevent: evhttp_add_header: key: Connection val: close

2019-08-29T08:49:20Z libevent: event_active: 0xafe37410 (fd -1), res 0, callback 0xb6d05e4d
2019-08-29T08:49:20Z Interrupting HTTP server
2019-08-29T08:49:20Z Interrupting HTTP RPC server
2019-08-29T08:49:20Z Interrupting RPC
2019-08-29T08:49:20Z tor: Thread interrupt
2019-08-29T08:49:20Z libevent: event_active: 0xafe376e0 (fd -1), res 1, callback 0xb69fc735
2019-08-29T08:49:20Z Shutdown: In progress...
2019-08-29T08:49:20Z Stopping HTTP RPC server
2019-08-29T08:49:20Z Unregistering HTTP handler for / (exactmatch 1)
2019-08-29T08:49:20Z Unregistering HTTP handler for /wallet/ (exactmatch 0)
2019-08-29T08:49:20Z addcon thread exit
2019-08-29T08:49:20Z net thread exit
2019-08-29T08:49:20Z Stopping RPC
2019-08-29T08:49:20Z msghand thread exit
2019-08-29T08:49:20Z RPC stopped.
2019-08-29T08:49:20Z Stopping HTTP server
2019-08-29T08:49:20Z Waiting for HTTP worker threads to exit
2019-08-29T08:49:20Z libevent: event_del: 0xb8335494 (fd 9), callback 0xb6a01141
2019-08-29T08:49:20Z libevent: Epoll DEL(1) on fd 9 okay. Old events were 2; read change was 2 (del); write change was 0 (none); close change was 0 (none)
2019-08-29T08:49:20Z libevent: event_del: 0xb83355fc (fd 10), callback 0xb6a01141
2019-08-29T08:49:20Z libevent: Epoll DEL(1) on fd 10 okay. Old events were 2; read change was 2 (del); write change was 0 (none); close change was 0 (none)
2019-08-29T08:49:20Z Waiting for HTTP event thread to exit
2019-08-29T08:49:21Z ERROR: Error while reading proxy response
2019-08-29T08:49:21Z opencon thread exit
`
and this is where both bitcoind and bitcoin-cli hang.

This can be reproduced every time: start bitcoind. do anything with bitcoin-cli.

this is a self-compiled version of v0.18.1 for termux, the same happens on v0.18.0.

The machine is a Sony Xperia Z android 5 smartphone running termux on flash media.

I suspect it might be because of the bionic libs or libevent(_pthread), which is also modified because the native termux package doesn't contain the pthread-library. I can provide details on the compilation process if that's helpful. Maybe @esotericnonsense has any ideas, since he seems to have run bitcoind on termux before, though seemingly in a chroot.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions