It is common to close network connection while another goroutine is
blocked reading on another goroutine. This sequence corresponds to
windows calls to WSARecv to start io, followed by GetQueuedCompletionStatus
that blocks until io completes, and, finally, closesocket called from
another thread. We were expecting that closesocket would unblock
GetQueuedCompletionStatus, and it does, but not always
(http://code.google.com/p/go/issues/detail?id=4170#c5). Also that sequence
results in connection is being reset.
This CL inserts CancelIo between GetQueuedCompletionStatus and closesocket,
and waits for both WSARecv and GetQueuedCompletionStatus to complete before
proceeding to closesocket. This seems to fix both connection resets and
issue 4170. It also makes windows code behave similar to unix version.
Unfortunately, CancelIo needs to be called on the same thread as WSARecv.
So we have to employ strategy we use for connections with deadlines to
every connection now. It means, there are 2 unavoidable thread switches
for every io. Some newer versions of windows have new CancelIoEx api that
doesn't have these drawbacks, and this CL uses this capability when available.
As time goes by, we should have less of CancelIo and more of CancelIoEx
systems. Computers with CancelIoEx are also not affected by issue 4195 anymore.
Fixes#3710Fixes#3746Fixes#4170
Partial fix for issue 4195
R=golang-dev, mikioh.mikioh, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/6604072
compiler_rt introduces a weak and hidden symbol compilerrt_abort_impl
into our pre-linked _all.o object, we have to handle it.
Fixes#4273.
R=iant, rsc, r
CC=golang-dev
https://golang.org/cl/6783050
Feature extraction was tested before, but not the final diffs.
This CL breaks function main into a smaller main + testable
compareAPI.
No functional changes.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/6820057
On 6g/linux:
benchmark old ns/op new ns/op delta
BenchmarkFDCT 4606 4241 -7.92%
BenchmarkIDCT 4187 3923 -6.31%
BenchmarkDecodeBaseline 3154864 3170224 +0.49%
BenchmarkDecodeProgressive 4072812 4017132 -1.37%
BenchmarkEncode 39406920 34596760 -12.21%
Stack requirements before (from 'go tool 6g -S'):
(scan.go:37) TEXT (*decoder).processSOS+0(SB),$1352-32
(writer.go:448) TEXT (*encoder).writeSOS+0(SB),$5344-24
after:
(scan.go:37) TEXT (*decoder).processSOS+0(SB),$1064-32
(writer.go:448) TEXT (*encoder).writeSOS+0(SB),$2520-24
Also, in encoder.writeSOS, re-use the yBlock scratch buffer for Cb and
Cr. This reduces the stack requirement slightly, but also avoids an
unlucky coincidence where a BenchmarkEncode stack split lands between
encoder.writeByte and bufio.Writer.WriteByte, which occurs very often
during Huffman encoding and is otherwise disasterous for the final
benchmark number. FWIW, the yBlock re-use *without* the s/int/int32/
change does not have a noticable effect on the benchmarks.
R=r
CC=golang-dev, rsc
https://golang.org/cl/6823043
Fix the problem with no cookie handling when sending
other than GET or HEAD request through
(*Client) Do(*Request) (*Resposne, error).
https://code.google.com/p/go/issues/detail?id=3985
Adds a function (*Client) send(*Request) (*Reponse, error):
- sets cookies from CookieJar to request,
- sends request
- parses a reply cookies and updates CookieJar
Fixes#3985
R=bradfitz
CC=gobot, golang-dev
https://golang.org/cl/6653049
Previously we converted a time to UTC *and* serialized the timezone of
the original time. With this change, we serialize a UTCTime in the
original timezone.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6817048
- make sure dclcontext == PAUTO only in function bodies
- introduce PDISCARD to discard declarations in bodies of repeated imports
- skip printing initializing OAS'es in export mode, assuming they only occur after ODCL's
- remove ODCL and the initializing OAS from inl.c:ishairy
- fix confused use of ->typecheck in typecheckinl: it's about the ->inl, not about the fn.
- debuging aids: print ntype on ONAMEs too and -Emm instead of -Ell.
fixes#2812
R=rsc
CC=golang-dev
https://golang.org/cl/6800043
includes step 0: synthesize outparams, from 6600044
includes step 1,2: give outparams loopdepth 0 and verify unchanged results
generate esc:$mask tags, but still tie to sink if a param has mask != 0
from 6610054
adds final steps:
- have esccall generate n->escretval, a list of nodes the function results flow to
- use these in esccall and ORETURN/OAS2FUNC/and f(g())
- only tie parameters to sink if tag is absent, otherwise according to mask, tie them to escretval
R=rsc, bradfitz
CC=dave, gobot, golang-dev, iant, rsc
https://golang.org/cl/6741044
The "did_ftplugin" lines were ineffective and the "K" mapping was too
invasive, which is why it was removed.
R=golang-dev, dsymonds, minux.ma
CC=golang-dev
https://golang.org/cl/6823044
Too many people quote entire emails and put their reply at the top ("top posting"),
so we shouldn't recognise review commands anywhere in the review text.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6815048
Before this patch the test would close the file descriptor but
not the os.File. When the os.File was GC'ed, the finalizer
would close the file descriptor again. That would cause
problems if the same file descriptor were returned by a later
call to open in another test.
On my system:
> GOGC=30 go test
--- FAIL: TestPassFD (0.04 seconds)
passfd_test.go:62: FileConn: dup: bad file descriptor
FAIL
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6776053
setAddr was showing up in profiles due to string concatenation construction the os.File name field. netFD.sysfile's Name() is never used, except in dup() so I believe it is safe to avoid this allocation.
R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/6742058
- Allow secondary values below the default value in second form. This is
to support before tags for secondary values, as used by Chinese.
- Eliminate collation elements that are guaranteed to be immaterial
after a weight increment.
R=r
CC=golang-dev
https://golang.org/cl/6739051
includes step 0: synthesize outparams, from 6600044
step 1: give outparams loopdepth 0 and verify unchanged results
step 2: generate esc:$mask tags, but still tie to sink if a param has mask != 0
next step: use in esccall (and ORETURN with implicit OAS2FUNC) to avoid tying to sink
R=rsc
CC=golang-dev
https://golang.org/cl/6610054
in typecheck and walk, conversion from OAS2RECV to OAS2
and to OSELRECV2 duplicated the ->rlist->n to ->right
thereby destroying the strict tree-ness of the AST (up to
ONAMES) of course. Several recursions in esc.c and inl.c
and probably elsewhere assume nodes of the tree aren't duplicated.
rather than defensively code around this, i'd rather assert
these cases away and fix their cause.
(this was tripped in 6741044)
R=rsc
CC=golang-dev
https://golang.org/cl/6750043