The issues you are encountering with your sockets and process can be challenging, but there are steps you can take to troubleshoot and potentially resolve them: 1. Socket Error with Errno 9: - Error code 9 typically corresponds to "Bad file descriptor." This error commonly occurs when trying to perform an operation on a closed socket. Ensure socket handles are properly initialized and closed when not used. - Double-check the sequence of operations involving the socket to ensure it's used correctly. - Review your socket creation, initialization, and error-handling processes to detect any potential issues. 2. Process Stuck Issue: - The stack trace you provided indicates some issues related to sockets and synchronization primitives. - If your process is getting stuck, it could be due to improper synchronization or resource management. - Check for any areas in your code where resources like sockets or critical sections are not released appropriately. 3. Troubleshooting Steps: - Review your code logic for creating and closing sockets, ensuring they follow best practices and are error-free. - Implement thorough error handling to manage potential socket errors and the closure of resources. - Consider using debugging tools like GDB, Visual Studio Debugger, or other suitable debuggers to step through your code and identify the exact location where the issues occur. - Analyze your application's logic to detect any race conditions, blocking calls, or deadlock situations that might lead to a stuck process. By carefully examining your socket creation, usage, and process management, you can pinpoint the root cause of these issues and implement the necessary corrections to prevent them from occurring.