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

go1.15: go build -v fails unless -tags PSIPHON_DISABLE_QUIC is passed #866

Closed
bassosimone opened this issue Aug 20, 2020 · 15 comments
Closed
Assignees
Labels
bug Something isn't working effort/S Small effort interrupt Task not planned during planning priority/low Low priority

Comments

@bassosimone
Copy link
Member

bassosimone commented Aug 20, 2020

(We have now completely mitigated this issue by building atop the documented workaround.)

This is the output I obtain when compiling using Go 1.15:

% ./miniooni -h
panic: qtls.ConnectionState not compatible with tls.ConnectionState

goroutine 1 [running]:
github.com/Psiphon-Labs/quic-go/internal/handshake.init.1()
	/Users/sbs/go/pkg/mod/github.com/!psiphon-!labs/quic-go@v0.14.1-0.20200306193310-474e74c89fab/internal/handshake/unsafe.go:17 +0x12e

The reason seems to be that Go 1.15 changed its tls.ConnectionState structure. There is a fix applied upstream that handles this issue. It seems Psiphon is using its own fork of quic-go: https://github.com/Psiphon-Labs/quic-go.

This means that, for fixing the issue, the Psiphon devs need to backport the patch. For now, it's important to use Go 1.14 only for building OONI.

@bassosimone bassosimone added the bug Something isn't working label Aug 20, 2020
@bassosimone bassosimone self-assigned this Aug 20, 2020
@bassosimone bassosimone pinned this issue Aug 20, 2020
@bassosimone bassosimone added the priority/medium Medium priority label Aug 31, 2020
@bassosimone
Copy link
Member Author

bassosimone commented Sep 9, 2020

Documented workaround

Psiphon devs just recommended this workaround (which also works for me): go build -a -v -tags "DISABLE_QUIC" which has been confirmed to be working for them when using Psiphon and Go 1.15. Many thanks!

@cyBerta
Copy link
Contributor

cyBerta commented Sep 16, 2020

I adapted the build script accordingly. Is it worth a PR?

@bassosimone
Copy link
Member Author

Who's building using go build -v ./... is gonna get a broken binary anyway, unless the proper tag is passed from command line. Because of this reasoning, I believe fixing the script to conditionally disable QUIC when developing using Go 1.15 is not fully solving the problem, because we're producing a broken binary for who's not using the build script.

How about: we create one/two files in the top-level package that only conditionally build if either we're in Go 1.14 or the user has provided the DISABLE_QUIC tag? With this solution, the build breaks. This is arguably better than breaking the binary, which is something that is definitely going to be much more surprising for the user?

What do you think?

@cyBerta
Copy link
Contributor

cyBerta commented Sep 17, 2020

When I started to figure out how to build the project, the first thing I did was to have a look at the build script to see the necessary flags etc.. But I'm fine with adding a file that crashes the build on compile time if preconditions are not met. I'll propose something in a PR, together with the changes for the build script.

EDIT: This compile time hack should be undone as soon as soon as the psyphon folks have updated their fork.

@bassosimone
Copy link
Member Author

EDIT: This compile time hack should be undone as soon as soon as the psyphon folks have updated their fork.

Yes, indeed. Ideally, the tag should only be added to the compilation when using Go 1.15, while Go 1.14 binaries should continue to be compiled without it. So the only functional change is better user experiences for folks on Go 1.15.

cyBerta added a commit to cyBerta/probe-engine that referenced this issue Sep 18, 2020
cyBerta added a commit to cyBerta/probe-engine that referenced this issue Sep 21, 2020
bassosimone pushed a commit that referenced this issue Sep 21, 2020
* workaround to build probe-engine with go1.15 (#866)

* change order of arguments so that empty -tags argument will be ignored correctly
bassosimone added a commit that referenced this issue Sep 21, 2020
I just figured it's probably more transparent to inform the user running
the build script that we're applying this workaround.

Also, in readme_compiletimecheck.go, let us mention explicitly what is
the build script that we could use for increased clarity.

Related to #866.
bassosimone added a commit that referenced this issue Sep 21, 2020
We now have a workaround for people building using go1.15. We wanna make
sure with a simple smoke test we produce a working miniooni binary.

Also part of #866.
bassosimone added a commit that referenced this issue Sep 21, 2020
* build-cli.sh: say it when we apply workaround

I just figured it's probably more transparent to inform the user running
the build script that we're applying this workaround.

Also, in readme_compiletimecheck.go, let us mention explicitly what is
the build script that we could use for increased clarity.

Related to #866.

* github/workflows: make sure we don't break go1.15 builds

We now have a workaround for people building using go1.15. We wanna make
sure with a simple smoke test we produce a working miniooni binary.

Also part of #866.
@bassosimone
Copy link
Member Author

So, this is where we are at now. When using Go 1.15 and compiling, you'll get:

# go build -v ./cmd/miniooni/
github.com/ooni/probe-engine
# github.com/ooni/probe-engine
./readme_compiletimecheck.go:6:1: syntax error: non-declaration statement outside function body

and ./readme_compiletimecheck.go contains:

# cat readme_compiletimecheck.go 
//+build !DISABLE_QUIC
//+build go1.15

package engine

ATTENTION: If you are compiling probe-engine with go1.15 please make sure
to pass -tags DISABLE_QUIC. Alternatively use ./build-cli.sh.

Also building with -tags DISABLE_QUIC works (as it used to work before). Also, when you are using ./build-cli.sh the code will also emit a warning pointing you to this issue:

# ./build-cli.sh linux
Warning: disabling QUIC when using Go 1.15.
See https://github.com/ooni/probe-engine/issues/866 for more info.
+ export 'GOOS=linux' 'GOARCH=amd64'
+ go build -o ./CLI/linux/amd64 -tags DISABLE_QUIC,netgo '-ldflags=-s -w -extldflags "-static"' ./cmd/miniooni

We will still keep it open and pinned. People compiling with Go 1.15 will still see an error unless they do not apply the workaround when building. Also, the name of the issue can now be changed.

@bassosimone bassosimone changed the title Binaries broken when using Go 1.15 go1.15: go build -v fails unless -tags DISABLE_QUIC is passed Sep 21, 2020
@bassosimone bassosimone added priority/low Low priority and removed priority/medium Medium priority labels Sep 25, 2020
@bassosimone bassosimone changed the title go1.15: go build -v fails unless -tags DISABLE_QUIC is passed go1.15: go build -v fails unless -tags PSIPHON_DISABLE_QUIC is passed Oct 23, 2020
bassosimone added a commit that referenced this issue Oct 23, 2020
@bassosimone bassosimone changed the title go1.15: go build -v fails unless -tags PSIPHON_DISABLE_QUIC is passed go1.15: go build -v fails unless -tags DISABLE_QUIC is passed Oct 23, 2020
bassosimone added a commit that referenced this issue Oct 23, 2020
* fix(oonimkall/session.go): export stats to mobile

Closes #959

* fix(ndt7): reduce unnecessary memory usage

Closes #719

* Update to github.com/ooni/probe-assets@20201023140148

Part of #590

* chore: update dependencies

Part of #972

* chore: update the user-agent header we use

See #972

* fix: psiphon is now using PSIPHON_DISABLE_QUIC

Related to #866

* chore(version.go): we're at 0.19.0 stable

See #972

* chore: update bundled certificates

See #972

While there make sure releases documentation highlights the purpose
rather than just the action we need to perform.
@bassosimone bassosimone changed the title go1.15: go build -v fails unless -tags DISABLE_QUIC is passed go1.15: go build -v fails unless -tags PSIPHON_DISABLE_QUIC is passed Oct 27, 2020
@bassosimone
Copy link
Member Author

Changed issue title since now both the latest stable release (v0.19.0) and master use PSIPHON_DISABLE_QUIC

@bassosimone bassosimone added this to the Sprint 25 - Näkki milestone Nov 4, 2020
@bassosimone bassosimone added the interrupt Task not planned during planning label Nov 4, 2020
@bassosimone
Copy link
Member Author

bassosimone commented Nov 4, 2020

So, after #747, it seems we always need to add -tags PSIPHON_DISABLE_QUIC to use ooni/probe-engine. I am now starting to realise why this is painful for users. So, I tried to come up with another strategy that allows us to build without any flag at #1022. Currently, the PR is still in progress and quite rough around the edges; we have a TODO list to finalise it #1022 (comment). Also, of course, this issue is now high prio because we cannot release w/o fixing this issue.

@bassosimone bassosimone added priority/high High priority and removed priority/low Low priority labels Nov 4, 2020
bassosimone added a commit that referenced this issue Nov 5, 2020
Releasing a version of probe-engine that only builds with `-tags PSIPHON_DISABLE_QUIC` for every version of Go is a bad idea. This PR is based of https://github.com/ooni/psiphon, which is vendors psiphon sources and all its dependencies in a way that does not cause conflicts in the package path.

This codebase also disables QUIC support when using Go 1.15 (now the default on Fedora), so we don't have any conflict and the code builds seamlessly. Because I've been told by Psiphon developers that they're working to upgrade their QUIC implementation, this means we are not going to use Psiphon without QUIC for a long time when using Go 1.15. Also, they told me it should ~fine to use Psiphon without QUIC anyway. Lastly, we're currently using Go 1.14 for building our own packages, so we're not removing anything from our official packages.

With this diff committed, we dramatically simplify dependency management and we remove the requirement of specifying a manual flag to get probe-engine (and hence probe-cli) to compile with Go 1.15.

This is the reference issue: #866.
@bassosimone
Copy link
Member Author

This issue has been solved by #1022.

@bassosimone bassosimone added the effort/S Small effort label Nov 5, 2020
@bassosimone
Copy link
Member Author

We can close now

@bassosimone bassosimone unpinned this issue Nov 5, 2020
@bassosimone
Copy link
Member Author

Reopening until we have a stable version for which this is fixed!

@bassosimone bassosimone reopened this Nov 6, 2020
@bassosimone bassosimone pinned this issue Nov 6, 2020
@bassosimone
Copy link
Member Author

Moving to next Sprint where we'll publish a release fixing this issue.

@bassosimone bassosimone added priority/low Low priority and removed priority/high High priority labels Nov 9, 2020
@bassosimone
Copy link
Member Author

No need to keep this in Sprint 26, since it's mentioned at #1004. Removing from this milestone.

@bassosimone bassosimone removed this from the Sprint 26 - Neerali milestone Nov 9, 2020
@bassosimone
Copy link
Member Author

This is fixed in v0.20.0

@bassosimone bassosimone unpinned this issue Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort/S Small effort interrupt Task not planned during planning priority/low Low priority
Projects
None yet
Development

No branches or pull requests

2 participants