Skip to content

Race condition when quitting and kill(::Process) is in a finalizer #19258

Open

Description

ericdavies@mccreary ~/r/julia0p5 (release-0.5)> julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.1-pre+27 (2016-11-04 08:41 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 25f7066* (3 days old release-0.5)
|__/                   |  x86_64-apple-darwin16.1.0

julia> type Foo
           proc::Base.Process
       end

julia> a = Foo(spawn(`python -m SimpleHTTPServer`))
Foo(Process(`python -m SimpleHTTPServer`, ProcessRunning))

julia> finalizer(a, x->kill(x.proc))

julia> quit()
error in running finalizer: Base.AssertionError(msg="p.handle != C_NULL")

This only happens about half the time. When it does happen, the process is left as an orphan. When it doesn't, the kill executes correctly and kills the process.

I was able to replicate on the latest master (f9a6bbd) as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    won't changeIndicates that work won't continue on an issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions