Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(6636)

Issue 7406054: identityservice: out-of-random nil error (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by jameinel
Modified:
11 years, 1 month ago
Reviewers:
dimitern, mp+150751, rog
Visibility:
Public.

Description

identityservice: out-of-random nil error I was running the test suite on my VM, and I think I rand out of entropy for a bit. It ended up that I got a nil pointer dereference exception, which I traced back to the randomHexToken code incorrectly handling when it doesn't read enough bytes. (It isn't an error, it just gets a count smaller than it expected.) To make it testable, I ended up moving the direct function call into a pointer that can be overridden. I also discovered that Go-1.0+ doesn't allow you to compare function pointers (in case a compiler wants to do interesting optimizations). So I ended up doing a bit of a workaround. It was a longer side trip than I expected, but it did get me exposed to gocheck.Checkers and some other reasonable bits. https://code.launchpad.net/~jameinel/goose/rand-failures/+merge/150751 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 6

Patch Set 2 : identityservice: out-of-random nil error #

Total comments: 10

Patch Set 3 : identityservice: out-of-random nil error #

Total comments: 2

Patch Set 4 : identityservice: out-of-random nil error #

Unified diffs Side-by-side diffs Delta from patch set Stats (+87 lines, -9 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M testservices/identityservice/util.go View 1 2 2 chunks +8 lines, -9 lines 0 comments Download
M testservices/identityservice/util_test.go View 1 2 3 2 chunks +77 lines, -0 lines 0 comments Download

Messages

Total messages: 10
jameinel
Please take a look.
11 years, 2 months ago (2013-02-27 09:56:11 UTC) #1
dimitern
LGTM https://codereview.appspot.com/7406054/diff/1/testservices/identityservice/util_test.go File testservices/identityservice/util_test.go (right): https://codereview.appspot.com/7406054/diff/1/testservices/identityservice/util_test.go#newcode35 testservices/identityservice/util_test.go:35: c.Assert(string(raw), Equals, "\x00\x00\x00\x00\x00\x00") I don't think you need ...
11 years, 2 months ago (2013-02-27 10:15:31 UTC) #2
rog
good to sort this out, but i think a slightly different approach might work out ...
11 years, 2 months ago (2013-02-27 12:19:32 UTC) #3
jameinel
Please take a look.
11 years, 2 months ago (2013-02-28 10:34:59 UTC) #4
jameinel
Please take a look. https://codereview.appspot.com/7406054/diff/1/testservices/identityservice/util.go File testservices/identityservice/util.go (right): https://codereview.appspot.com/7406054/diff/1/testservices/identityservice/util.go#newcode25 testservices/identityservice/util.go:25: func setRandomizer(r randomizer) (restore func()) ...
11 years, 2 months ago (2013-02-28 10:39:47 UTC) #5
rog
better, thanks, but i think it can be simpler still. https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util.go File testservices/identityservice/util.go (right): https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util.go#newcode24 ...
11 years, 2 months ago (2013-02-28 11:36:15 UTC) #6
jameinel
Please take a look. https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util.go File testservices/identityservice/util.go (right): https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util.go#newcode47 testservices/identityservice/util.go:47: if n != 32 || ...
11 years, 2 months ago (2013-02-28 13:04:25 UTC) #7
rog
much better thanks. LGTM with a few remaining thoughts below. https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util_test.go File testservices/identityservice/util_test.go (right): https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util_test.go#newcode84 ...
11 years, 2 months ago (2013-02-28 15:06:56 UTC) #8
jameinel
https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util_test.go File testservices/identityservice/util_test.go (right): https://codereview.appspot.com/7406054/diff/7001/testservices/identityservice/util_test.go#newcode84 testservices/identityservice/util_test.go:84: } added
11 years, 2 months ago (2013-03-08 21:54:54 UTC) #9
jameinel
11 years, 2 months ago (2013-03-08 21:59:29 UTC) #10
Please take a look.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b