Skip to content

Language server unexpectedly terminated error #627

@soulomoon

Description

@soulomoon

HLS's tests sometimes trigger Language server unexpectedly terminated,
which means the pipe might be closed before we cancel the consuming thread.

I believe I find one of the cause.

runSession' :: ...
...
...
...
        finally (timeout msgTimeoutMs (runSession' exitServer))
                -- Make sure to kill the listener first, before closing
                -- handles etc via cleanupProcess
                (killThread tid >> cleanup)

Since killThread tid = throwTo tid ThreadKilled, it won't wait for the target thread to exit.
Fix can be trival, simply use async instead of forkIO and use cancel instead of killThread

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions