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

gotosocial: 0.14.2 -> 0.15.0 #303321

Merged
merged 3 commits into from
Apr 24, 2024
Merged

Conversation

jugendhacker
Copy link
Member

Description of changes

New release: https://github.com/superseriousbusiness/gotosocial/releases/tag/v0.15.0

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Contributor

@misuzu misuzu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestValidationTestSuite/TestValidateEmail is fixed now (thank you, @blakesmith!), we should remove it from skippedTests

@jugendhacker jugendhacker requested a review from misuzu April 11, 2024 14:35
@misuzu
Copy link
Contributor

misuzu commented Apr 13, 2024

Looks like another flaky test

ok      github.com/superseriousbusiness/gotosocial/internal/processing/polls    0.385s
timestamp="11/04/2024 15:23:30.311" func=dereferencing.(*Dereferencer).RefreshStatusAsync.func1 level=ERROR msg="error enriching remote status: enrichStatus: error dereferencing http://fossbros-anonymous.io/users/foss_satan/statuses/01FVW7JHQFSFK166WWKR8CBA6M: Dereference: GET request to http://fossbros-anonymous.io/users/foss_satan/statuses/01FVW7JHQFSFK166WWKR8CBA6M failed: status=\"\" body=\"{\"error\":\"404 not found\"}\""
--- FAIL: TestStatusCreateTestSuite (6.56s)
    --- FAIL: TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus (0.88s)
        create_test.go:276: 
                Error Trace:    /build/source/internal/processing/status/create_test.go:276
                Error:          Received unexpected error:
                                GetAPIStatus: error converting status: statusToFrontend: error converting status author: AccountToAPIAccountPublic: error counting statuses: database table is locked (262)
                Test:           TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus
        create_test.go:277: 
                Error Trace:    /build/source/internal/processing/status/create_test.go:277
                Error:          Expected value not to be nil.
                Test:           TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus
        panic.go:261: test panicked: runtime error: invalid memory address or nil pointer dereference
            goroutine 557 [running]:
            runtime/debug.Stack()
                /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/runtime/debug/stack.go:24 +0x5e
            github.com/stretchr/testify/suite.failOnPanic(0xc000ed31e0, {0x21caac0, 0x3e7eea0})
                /build/source/vendor/github.com/stretchr/testify/suite/suite.go:89 +0x37
            github.com/stretchr/testify/suite.Run.func1.1()
                /build/source/vendor/github.com/stretchr/testify/suite/suite.go:188 +0x299
            panic({0x21caac0?, 0x3e7eea0?})
                /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/runtime/panic.go:770 +0x132
            github.com/superseriousbusiness/gotosocial/internal/processing/status_test.(*StatusCreateTestSuite).TestProcessReplyToUnthreadedRemoteStatus(0xc00026c608)
                /build/source/internal/processing/status/create_test.go:282 +0x20f
            reflect.Value.call({0xc001374000?, 0xc000615ea0?, 0xc009d2eb40?}, {0x2493284, 0x4}, {0xc00c007f28, 0x1, 0x21e1cc0?})
                /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/reflect/value.go:596 +0xce5
            reflect.Value.Call({0xc001374000?, 0xc000615ea0?, 0x37d2f50?}, {0xc00c007f28?, 0xf?, 0x0?})
                /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/reflect/value.go:380 +0xb9
            github.com/stretchr/testify/suite.Run.func1(0xc000ed31e0)
                /build/source/vendor/github.com/stretchr/testify/suite/suite.go:202 +0x4a5
            testing.tRunner(0xc000ed31e0, 0xc000cb5e60)
                /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/testing/testing.go:1689 +0xfb
            created by testing.(*T).Run in goroutine 350
                /nix/store/mzg3cka0bbr5jq96ysymwziw74fnk22m-go-1.22.1/share/go/src/testing/testing.go:1742 +0x390
FAIL
FAIL    github.com/superseriousbusiness/gotosocial/internal/processing/status   9.361s
FAIL
error: builder for '/nix/store/aw52fm9577jdl83zp4gvziadg66nbznj-gotosocial-0.15.0.drv' failed with exit code 1;

Builds fine on my machine

(finished: must succeed: curl -sS -f http://localhost:8081/nodeinfo/2.0 | jq '.usage.users.total' | grep -q '^1$', in 0.06 seconds)
(finished: run the VM test script, in 17.70 seconds)
test script finished in 17.78s
cleanup
kill machine (pid 9)
qemu-kvm: terminating on signal 15 from pid 6 (/nix/store/gd3shnza1i50zn8zs04fa729ribr88m9-python3-3.11.8/bin/python3.11)
(finished: cleanup, in 0.01 seconds)
kill vlan (pid 7)
/nix/store/frdz9vsrz72gbyk3jxnpndh2ns00gv6n-vm-test-run-gotosocial

@blakesmith
Copy link
Contributor

blakesmith commented Apr 13, 2024

@misuzu I saw this database is locked test failure sporadically as well on early 0.14 versions, but could only get it to reproduce via ofborg runs (never on my local x86 linux machine). I'm not familiar with how ofborg is setup to know if there's any configuration that would lead to more likely failures.

Looks like something might be accidentally holding the lock to the sqlite database beyond the timeout, that's causing the build failure. By default, the gotosocial test suite runs with an in-memory sqlite database, so there must be some additional concurrency issues happening here during this test to cause the issue.

There was some recent work in superseriousbusiness/gotosocial#2774 to fix some "database is locked" bugs happening with a live instance, but not sure if this is related.

@blakesmith
Copy link
Contributor

Looks like our gotosocial friends upstream have seen the same sporadic test suite failures due to in-memory sqlite. See: superseriousbusiness/gotosocial#2774 (comment).

I wonder if there's a way we can configure the tests to use a temporary persistent sqlite db on the filesystem (instead of in-memory). This would also run the same way it would run in production via PRAGMA journal_mode=WAL, which is better at handling concurrent readers / writers. The test suite supports testing via a persistent postgres instance, so this should theoretically be possible!

That being said, I'm going to:

  1. Rerun ofborg checks for now. It would be nice to get to 0.15, since this is not a real failure in the package that needs fixing.
  2. Investigate possible ways to run the test suite in a way that more accurately represents how the code will run when in production. It would be nice to not have this issue continue cropping up during package updates.
  3. (Maybe): See if there are other ways to make the tests run more reliably with sqlite in-memory.

@blakesmith
Copy link
Contributor

blakesmith commented Apr 13, 2024

@ofborg test gotosocial

@blakesmith
Copy link
Contributor

@ofborg build gotosocial

@blakesmith
Copy link
Contributor

blakesmith commented Apr 13, 2024

Update: I can get several tests to reliably fail in gotosocial's upstream test suite by running them repeatedly. Like I mentioned before, this seems like a broader issue with how the test suite runs via an in-memory sqlite database, which doesn't have the same concurrency semantics as when gotosocial runs on a real instance with sqlite, and WAL mode enabled.

With gotosocial checked out, you can pretty reliably get the test suite to fail by rerunning a test many times:

$ go test ./... -count=100 -run=TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus

Leads to many test failures such as:

--- FAIL: TestStatusCreateTestSuite (0.90s)
    --- FAIL: TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus (0.90s)
        create_test.go:276:
                Error Trace:    /home/blake/src/gotosocial/internal/processing/status/create_test.go:276
                Error:          Received unexpected error:
                                GetAPIStatus: error converting status: statusToFrontend: error converting status author: AccountToAPIAccountPublic: error counting statuses: database table is locked (262)
                Test:           TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus
        create_test.go:277:
                Error Trace:    /home/blake/src/gotosocial/internal/processing/status/create_test.go:277
                Error:          Expected value not to be nil.
                Test:           TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus
        panic.go:261: test panicked: runtime error: invalid memory address or nil pointer dereference
            goroutine 5830 [running]:
            runtime/debug.Stack()
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/runtime/debug/stack.go:24 +0x5e
            github.com/stretchr/testify/suite.failOnPanic(0xc0a0a7cd00, {0x21370a0, 0x3ba7c80})
                /home/blake/src/gotosocial/vendor/github.com/stretchr/testify/suite/suite.go:89 +0x37
            github.com/stretchr/testify/suite.Run.func1.1()
                /home/blake/src/gotosocial/vendor/github.com/stretchr/testify/suite/suite.go:188 +0x25d
            panic({0x21370a0?, 0x3ba7c80?})
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/runtime/panic.go:914 +0x21f
            github.com/superseriousbusiness/gotosocial/internal/processing/status_test.(*StatusCreateTestSuite).TestProcessReplyToUnthreadedRemoteStatus(0xc0a5080000)
                /home/blake/src/gotosocial/internal/processing/status/create_test.go:282 +0x22a
            reflect.Value.call({0xc000948880?, 0xc09d8f4a20?, 0xc0a72e1060?}, {0x23f5127, 0x4}, {0xc08f57be70, 0x1, 0xc08f57bd78?})
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/reflect/value.go:596 +0xce7
            reflect.Value.Call({0xc000948880?, 0xc09d8f4a20?, 0xc0a5080000?}, {0xc08f57be70?, 0x535fad?, 0x357d5b0?})
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/reflect/value.go:380 +0xb9
            github.com/stretchr/testify/suite.Run.func1(0xc0a0a7cd00)
                /home/blake/src/gotosocial/vendor/github.com/stretchr/testify/suite/suite.go:202 +0x467
            testing.tRunner(0xc0a0a7cd00, 0xc09d8cefc0)
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 5829
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/testing/testing.go:1648 +0x3ad

EDIT: However! I cannot get the tests to fail when running them with an actual sqlite database on the filesystem. This works:

GTS_DB_TYPE="sqlite" GTS_DB_ADDRESS="/tmp/test_gotosocial.db" go test ./... -count=100 -run=TestStatusCreateTestSuite/TestProcessReplyToUnthreadedRemoteStatus

@misuzu Does it make sense to run our check tests somehow with something temporary on the filesystem? I worry about portability, and state on the machine, but there might be other examples in nixpkgs that do something like this that I'm not aware of.

Will be digging into this more soon on the upstream side.

@misuzu
Copy link
Contributor

misuzu commented Apr 14, 2024

Does it make sense to run our check tests somehow with something temporary on the filesystem?

I think it should be fine if it doesn't write anything to the $out. Something like this should do the trick:

env = {
  GTS_DB_TYPE = "sqlite";
  GTS_DB_ADDRESS = "/tmp/test_gotosocial.db";
};

@blakesmith
Copy link
Contributor

blakesmith commented Apr 14, 2024

Looks like running the full test suite with a persistent, on-disk sqlite has other issues. Several tests that fail due to state being carried across tests. One example (amongst many):

   --- FAIL: TestTokenTestSuite/TestRetrieveClientCredentialsOK (0.99s)
        log.go:148: test panicked: already exists
            goroutine 116 [running]:
            runtime/debug.Stack()
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/runtime/debug/stack.go:24 +0x5e
            github.com/stretchr/testify/suite.failOnPanic(0xc002020820, {0x21c7600, 0xc001b88460})
                /home/blake/src/gotosocial/vendor/github.com/stretchr/testify/suite/suite.go:89 +0x37
            github.com/stretchr/testify/suite.Run.func1.1()
                /home/blake/src/gotosocial/vendor/github.com/stretchr/testify/suite/suite.go:188 +0x25d
            panic({0x21c7600?, 0xc001b88460?})
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/runtime/panic.go:914 +0x21f
            github.com/superseriousbusiness/gotosocial/internal/log.Panic.func1()
                /home/blake/src/gotosocial/internal/log/log.go:148 +0x25
            github.com/superseriousbusiness/gotosocial/internal/log.Panic({0x0, 0x0}, {0xc000700a20, 0x1, 0x1})
                /home/blake/src/gotosocial/internal/log/log.go:150 +0x117
            github.com/superseriousbusiness/gotosocial/testrig.StandardDBSetup({0x2ac74e8, 0xc00217e960}, 0xc00221b2f0)
                /home/blake/src/gotosocial/testrig/db.go:144 +0x151
            github.com/superseriousbusiness/gotosocial/internal/api/auth_test.(*AuthStandardTestSuite).SetupTest(0xc00020d900)
                /home/blake/src/gotosocial/internal/api/auth/auth_test.go:95 +0x32a
            github.com/stretchr/testify/suite.Run.func1(0xc002020820)
                /home/blake/src/gotosocial/vendor/github.com/stretchr/testify/suite/suite.go:192 +0x1ee
            testing.tRunner(0xc002020820, 0xc000acecf0)
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 59
                /nix/store/vxxlsbznhhkw1sb7qi5wki03d2sihpha-go-1.21.8/share/go/src/testing/testing.go:1648 +0x3ad

So we're back to where we started.

@misuzu Are we at the point where we should skip the upstream test suite during derivation build? I have a sneaking suspicion we will continue to play wack-a-mole with flakey tests until we can help the upstream gotosocial team with broader test reliability improvements.

@misuzu
Copy link
Contributor

misuzu commented Apr 14, 2024

Are we at the point where we should skip the upstream test suite during derivation build?

Yeah, I guess we can run them manually on each update to make sure the package is not totally broken

@jugendhacker
Copy link
Member Author

Okay, so should I disable all tests for now in this PR?

@misuzu
Copy link
Contributor

misuzu commented Apr 16, 2024

Okay, so should I disable all tests for now in this PR?

Yes, please

Copy link
Contributor

@misuzu misuzu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Apr 23, 2024
@pbsds pbsds merged commit 115bbb6 into NixOS:master Apr 24, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants