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

Crash on Socket.close() #66

Closed
samlapse opened this issue Sep 8, 2023 · 2 comments · Fixed by #68
Closed

Crash on Socket.close() #66

samlapse opened this issue Sep 8, 2023 · 2 comments · Fixed by #68

Comments

@samlapse
Copy link

samlapse commented Sep 8, 2023

First, thank you for developing this fantastic lightweight server!

We've encountered a recurring crash, primarily when the iOS app is running in the background. The crash log is as follows:

Crashed: com.apple.root.user-initiated-qos.cooperative
0  libsystem_kernel.dylib         0x1e64 close + 8
1  App                          0x71c300 Socket.close() + 4384424704
2  App                          0x6f7eb8 HTTPServer.start() + 4384276152
3  libswift_Concurrency.dylib     0x41948 swift::runJobInEstablishedExecutorContext(swift::Job*) + 416
4  libswift_Concurrency.dylib     0x42868 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
5  libdispatch.dylib              0x15944 _dispatch_root_queue_drain + 396
6  libdispatch.dylib              0x16158 _dispatch_worker_thread2 + 164
7  libsystem_pthread.dylib        0xda0 _pthread_wqthread + 228
8  libsystem_pthread.dylib        0xb7c start_wqthread + 8

To provide further context, here are relevant code snippets related to how we start and stop the server:

 func start() {
        Task {
            do {
                if await !server.isListening {
                    try await server.start()
                }
            } catch (_ as CancellationError) {
                print("Task cancelled")
            } catch {
                logger.error("Error local server: \(error.localizedDescription)")
            }
        }
    }

    func stop() {
        let task = Task {
            await server.stop()
        }
        task.cancel()
    }

Thanks!

@swhitty swhitty linked a pull request Sep 18, 2023 that will close this issue
@swhitty
Copy link
Owner

swhitty commented Sep 18, 2023

Thank you for reporting this issue 🙏🏻

Please let me know if #68 fixes the issue for you.

@samlapse
Copy link
Author

Thanks a lot the crash is fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants