I have found the reason of the failure.
The process I wanted to debug was in a process namespace; and the debugger was out of it. When I started the debugger in the same namespace the problem gone away.
Question
During debugging a program with threads, I have a strange error:
(gdb) info threads
warning: unable to open /proc file '/proc/3663/status'
warning: Can't attach LWP 3663: No child processes
Cannot find new threads: debugger service failed
I get no other warnings during the debug session.
The process/thread 3663 doesn't exist.
How can it be that the gdb misunderstands the pid of the process/thread? What additional checks could I do to localize the problem?
Solution
I have found the reason of the failure.
The process I wanted to debug was in a process namespace; and the debugger was out of it. When I started the debugger in the same namespace the problem gone away.