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

Program hangs on GC activity #45928

Closed
PallHaraldsson opened this issue Jul 4, 2022 · 3 comments
Closed

Program hangs on GC activity #45928

PallHaraldsson opened this issue Jul 4, 2022 · 3 comments

Comments

@PallHaraldsson
Copy link
Contributor

PallHaraldsson commented Jul 4, 2022

Program from #45369 sometimes hangs (likely in any version), at least on Linux.

See: https://discourse.julialang.org/t/hang-on-1-6-6-1-7-0-julia-1-8-0-beta3-and-1-9/83752

@gbaraldi gbaraldi added the GC Garbage collector label Jul 4, 2022
@KristofferC
Copy link
Member

KristofferC commented Jul 4, 2022

Running

using Dates

const mem_size = 0x1_000_000

counter = let
    counter = 0
    start_t = now()

    while true
        dt =  Dates.second(now()) - Dates.second(start_t)
        dt > 15 && break
        if counter % 1000 == 0
            println("dt: $dt, counter: $counter")
        end
        counter += 1
        arr = Vector{Int32}(undef, mem_size)
        arr[rand(1:mem_size)] = rand(Int32, 1)[begin]
        # sleep(1)
    end
    counter
end

@show counter, mem_size

it shows:

dt: 11, counter: 415000
dt: 11, counter: 416000
dt: 11, counter: 417000
dt: 11, counter: 418000
dt: 11, counter: 419000
dt: 11, counter: 420000
dt: -48, counter: 421000
dt: -48, counter: 422000
dt: -48, counter: 423000

So it is clear that the script is just having a bug in how it calculates the elapsed time (not considering the wrapping of Dates.second(now())).

@PallHaraldsson
Copy link
Contributor Author

PallHaraldsson commented Jul 4, 2022

@gbaraldi or whoever, please drop GC label (I think I can't). Still, thanks for adding it... That was a wild-goose chase... never about allocation even (as I had discovered), only a bad idiom, I copy-pasted from @rssdev10's PR.

@gbaraldi gbaraldi removed the GC Garbage collector label Jul 4, 2022
@rssdev10
Copy link
Contributor

rssdev10 commented Jul 4, 2022

a bad idiom, I copy-pasted from @rssdev10's PR.

Actually, that works, but 45 seconds per minute only....

Thanks, 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

No branches or pull requests

4 participants