• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ooni / probe-cli / 7539168267
72%

Build:
DEFAULT BRANCH: master
Ran 16 Jan 2024 08:59AM UTC
Jobs 1
Files 533
Run time 31s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 Jan 2024 08:55AM UTC coverage: 79.483% (-0.009%) from 79.492%
7539168267

push

github

web-flow
fix(libtor): prevent concurrent instances (#1445)

This PR is about preventing concurrent `./internal/libtor` instances.
The `./internal/libtor` package links with `libtor.a` and runs
`tor_run_main`. The expectation of such a function is that a single
thread can execute within the same process. If we attempt to invoke
`tor_run_main` while another instance is running, this is most likely
going to cause memory corruption because the two instances try to
operate on the same static data structures.

To address this issue, we use atomic compare and swap and atomic set to
make sure there is just a single thread inside the "critical section"
consisting of calling `tor_run_main`. All the other threads would fail
with an error.

To test this branch on Linux, you need to run:

```sh
go run ./internal/cmd/buildtool linux cdeps zlib openssl libevent tor
```

to compile tor and its dependencies for GNU/Linux. (You would need
`build-essential`, `autoconf`, `automake`, and `libtool` being installed
on a Debian system.)

Then, run tests using:

```sh
go test -tags ooni_libtor -v ./internal/libtor/...
```

These tests should pass on a GNU/Linux system.

In addition to making sure we cannot have concurrent instances, this PR
also modifies some tests that were not using `SocksPort auto`. As a
result, those tests would fail in a system where `tor` is running as a
daemon.

Closes https://github.com/ooni/probe/issues/2623

---------

Co-authored-by: Ain Ghazal <99027643+ainghazal@users.noreply.github.com>

24987 of 31437 relevant lines covered (79.48%)

39.36 hits per line

Jobs
ID Job ID Ran Files Coverage
1 0 - 7539168267.1 16 Jan 2024 08:59AM UTC 0
79.48
GitHub Action Run
Source Files on build 7539168267
Detailed source file information is not available for this build.
  • Back to Repo
  • a62f36c9 on github
  • Prev Build on master (#7504058745)
  • Next Build on master (#7541135681)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc