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

mattn / go-sqlite3 / 668
54%

Build:
DEFAULT BRANCH: master
Ran 17 Feb 2018 06:13PM UTC
Jobs 16
Files 8
Run time 13min
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

pending completion
668

Pull #530

travis-ci

web-flow
Don't spawn interrupt goroutine if we know that context cannot be canceled

For a Go-only project the following code pattern

	go func() {
		select {
		case <-ctx.Done():
			// call some cancel

		case <-done:
			// work finished ok
		}
	}()

	// do some work
	close(done)

works good and fast - without high scheduling overhead because scheduler
usually puts spawned goroutine into run queue on the same OS thread and so
after done is closed control is passed to spawned goroutine without OS context
switch.

However in the presence of Cgo calls in "do some work" the situation can
become different - Cgo calls are treated by go runtime similarly to
system calls with the effect that goroutines spawned on original OS
thread tend to be migrated by scheduler to be executed on another OS
thread.

This in turn can bring high overhead for communicating on "done", which
ultimately can result in full context switch: if the spawned goroutine
had chance to run, already checked done and ctx to be not ready, and went
into sleep via wait on futex - showing as something like below in strace for
one read query (note futex calls):

	27867 00:38:39.782146 stat(".../neo.sqlite-journal", 0x7f83809c4a20) = -1 ENOENT (No such file or directory)
	27867 00:38:39.782165 pread64(3, "\0\0\0\33\0\0\10\235\0\0\10]\0\0\0\27", 16, 24) = 16
	27871 00:38:39.782179 <... pselect6 resumed> ) = 0 (Timeout)
	27868 00:38:39.782187 <... pselect6 resumed> ) = 0 (Timeout)
	27871 00:38:39.782193 futex(0xc4200f8538, FUTEX_WAIT, 0, NULL <unfinished ...>
	27868 00:38:39.782199 futex(0xc420013138, FUTEX_WAIT, 0, NULL <unfinished ...>
	27867 00:38:39.782205 stat(".../neo.sqlite-wal", 0x7f83809c4a20) = -1 ENOENT (No such file or directory)
	27867 00:38:39.782224 fstat(3, {st_mode=S_IFREG|0644, st_size=9031680, ...}) = 0
	27867 00:38:39.782247 futex(0xc420013138, FUTEX_WAKE, 1 <unfinished ...>
	27868 00:38:39.782259 <... futex resumed> ) = 0
	27867 00:38:39.782265 <... futex resumed> ) = 1
	27868 00:38:39.... (continued)
Pull Request #530: Don't spawn interrupt goroutine if we know that context cannot be canceled

17 of 17 new or added lines in 1 file covered. (100.0%)

846 of 1236 relevant lines covered (68.45%)

1871655.45 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
9
100.0
sqlite3.go

Uncovered Existing Lines

Lines Coverage ∆ File
34
100.0
sqlite3.go
Jobs
ID Job ID Ran Files Coverage
1 668.1 (GOTAGS=) 17 Feb 2018 06:13PM UTC 0
66.67
Travis Job 668.1
2 668.2 (GOTAGS=) 17 Feb 2018 06:13PM UTC 0
66.16
Travis Job 668.2
3 668.3 (GOTAGS=) 17 Feb 2018 06:14PM UTC 0
66.16
Travis Job 668.3
4 668.4 (GOTAGS=) 17 Feb 2018 06:16PM UTC 0
65.58
Travis Job 668.4
5 668.5 (GOTAGS=libsqlite3) 17 Feb 2018 06:14PM UTC 0
66.67
Travis Job 668.5
6 668.6 (GOTAGS=libsqlite3) 17 Feb 2018 06:16PM UTC 0
66.16
Travis Job 668.6
7 668.7 (GOTAGS=libsqlite3) 17 Feb 2018 06:17PM UTC 0
66.16
Travis Job 668.7
8 668.8 (GOTAGS=libsqlite3) 17 Feb 2018 06:21PM UTC 0
65.58
Travis Job 668.8
9 668.9 (GOTAGS=trace) 17 Feb 2018 06:18PM UTC 0
66.67
Travis Job 668.9
10 668.10 (GOTAGS=trace) 17 Feb 2018 06:19PM UTC 0
66.16
Travis Job 668.10
11 668.11 (GOTAGS=trace) 17 Feb 2018 06:19PM UTC 0
66.16
Travis Job 668.11
12 668.12 (GOTAGS=trace) 17 Feb 2018 06:22PM UTC 0
65.58
Travis Job 668.12
13 668.13 (GOTAGS=vtable) 17 Feb 2018 06:22PM UTC 0
66.67
Travis Job 668.13
14 668.14 (GOTAGS=vtable) 17 Feb 2018 06:23PM UTC 0
66.16
Travis Job 668.14
15 668.15 (GOTAGS=vtable) 17 Feb 2018 06:23PM UTC 0
66.16
Travis Job 668.15
16 668.16 (GOTAGS=vtable) 17 Feb 2018 06:26PM UTC 0
65.58
Travis Job 668.16
Source Files on build 668
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #668
  • Pull Request #530
  • PR Base - master (#667)
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