jhigginbotham64/Starlight.jl

Tests fail with segmentation fault

Opened this issue ยท 16 comments

Running the tests for Starlight with julia --project=. 'using Pkg; Pkg.test()' fails with the following:

signal (11): Segmentation fault
in expression starting at /home/silver/code/Starlight.jl/test/runtests.jl:11
unknown function (ip: 0x7fc648967ef0)
Allocations: 29808526 (Pool: 29798572; Big: 9954); GC: 35
ERROR: Package Starlight errored during testing (received signal: 11)
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/Types.jl:68
 [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
   @ Pkg.Operations ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/Operations.jl:1672
 [3] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Cmd, test_args::Cmd, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool, kwargs::Base.Pairs{Symbol, Base.PipeEndpoint, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.PipeEndpoint}}})
   @ Pkg.API ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:421
 [4] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.PipeEndpoint, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:149
 [5] test(pkgs::Vector{Pkg.Types.PackageSpec})
   @ Pkg.API ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:144
 [6] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:164
 [7] test()
   @ Pkg.API ~/.opt/julia-1.7.2/share/julia/stdlib/v1.7/Pkg/src/API.jl:158
 [8] top-level scope
   @ none:1

The full output with JULIA_DEBUG=Starlight can be found here

OS info

$ lsb_release -d
Description:	Void Linux
$ uname -smr
Linux 5.15.32_1 x86_64

Unfortunately my dev environment is borked at the moment, so I can't meaningfully try to reproduce this. ๐Ÿ™ƒ

Alas Starlight's error-reporting mechanisms aren't great either. ๐Ÿ™ƒ

There are several different ways to run Starlight's tests that may each yield slightly different results (all are supposed to work correctly tho):

  • what you did
  • ] test inside a REPL session
  • using Pkg; Pkg.test("Starlight") inside a REPL session
  • running runtests.jl as a script from the command line

I tend to only ever test the REPL methods, so it could be some bug I've just never seen (in which case I'd want to look at the error-reporting issue first), or it could be a bug with the released packages (I sure as heck hope not), or it could be an issue with your environment.

Could you try some of the other methods of running the tests and post your output?

Also, are you seeing either of the windows that are supposed to get created by the tests? I.e. do you have any sense for when the error occurs?

If you checked it out with Pkg.dev or some equivalent, did you follow up with Pkg.instantiate?

I just cloned the repository with git, didn't use Pkg.dev.

I do see the windows appear, as well as the bitmap font sprite get rendered. The debug output in the log might help to pinpoint exactly where it happens?

Unfortunately the debug output shows only a stacktrace of what Pkg is doing internally, because Starlight's error-reporting sucks. That's why I recommended you try a few others ways of running the tests.

Knowing that the windows appear and the stuff gets rendered is helpful tho.

Aha. I see the words Test Summary in the extended output. That's informative, it at least gets through all the tests. Probably segfaulting some time during shutdown.

Try running Pkg.instantiate too.

I won't be able to help much more until I get my dev environment fixed tomorrow. :(

instantiate doesn't seem to help

The tests do occasionally succeed (anecdotally, this seems to happen more often if I run test interactively? Might be placebo), and I occasionally get the following error instead of the longer backtrace:

Test Summary: |
signal (11): Segmentation fault
in expression starting at /home/silver/code/Starlight.jl/test/runtests.jl:11
unknown function (ip: 0x7fd5c396def0)
Allocations: 29815218 (Pool: 29805248; Big: 9970); GC: 35
ERROR: Package Starlight errored during testing (received signal: 11)

Interesting. I'll work on reproducing tomorrow after I fix my dev environment.

This happens at awake!
AECC8601-D95D-4D94-9CC7-888F4E41F943

After a bit more digging it's the propagation of awake! through whatever systemAwakeOrder() is. The element that doesn't like waking up is TS().

TS failing is to be expected given #14. These are separate issues.

systemAwakeOrder is just a...hack-y way to make sure that subsystems awake! in an order that doesn't cause bugs. It needs to be replaced by a proper subsystem dependency...system...

Actually, similar to #14 there is no ALSA device either, which may be why it's having a fit.

There's no ALSA device because...ugh, I forget what issue it is, but I had to add a workaround to my Julia startup. Need to document it somewhere.

Anyway I don't see a reason that would cause a segfault unless audio was being played, which the tests don't do.

@silversquirl I recently pushed changes that resolved a similar issue for someone else's PR. Can you confirm for me that this is still an issue with the latest development code?