Skip to content

Commit aa55a21

Browse files
jshabeautifulentropy
authored andcommitted
sa: improve errors from SetOrderError (#8656)
We were returning ServerInternal errors and dropping the actual error message on the floor. Instead, return a plain error (which will get turned into a serverInternal error higher in the stack). This avoids losing error messages from the database layer.
1 parent 14a05d3 commit aa55a21

6 files changed

Lines changed: 13 additions & 23 deletions

File tree

sa/sa.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,12 @@ func (ssa *SQLStorageAuthority) SetOrderError(ctx context.Context, req *sapb.Set
633633
errJSON,
634634
req.Id)
635635
if err != nil {
636-
return nil, berrors.InternalServerError("error updating order error field")
636+
return nil, fmt.Errorf("updating order error field: %s", err)
637637
}
638638

639639
n, err := result.RowsAffected()
640640
if err != nil || n == 0 {
641-
return nil, berrors.InternalServerError("no order updated with new error field")
641+
return nil, fmt.Errorf("no order updated with new error field: %s", err)
642642
}
643643

644644
return nil, nil

test/chisel2.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
import sys
1515
import signal
1616
import threading
17-
import time
18-
1917
from cryptography.hazmat.backends import default_backend
2018
from cryptography.hazmat.primitives.asymmetric import rsa
2119
from cryptography import x509
@@ -140,21 +138,13 @@ def auth_and_issue(domains, chall_type="dns-01", email=None, cert_output=None, c
140138
else:
141139
raise Exception("invalid challenge type %s" % chall_type)
142140

143-
# Make up to three attempts, retrying on badNonce errors
144-
for n in range(3):
145-
time.sleep(0.2 * n) # No sleep before the first attempt, then backoff
146-
try:
147-
order = client.poll_and_finalize(order)
148-
if cert_output is not None:
149-
with open(cert_output, "w") as f:
150-
f.write(order.fullchain_pem)
151-
except messages.Error as e:
152-
if e.typ == "urn:ietf:params:acme:error:badNonce":
153-
continue
154-
else:
155-
break
156-
finally:
157-
cleanup()
141+
try:
142+
order = client.poll_and_finalize(order)
143+
if cert_output is not None:
144+
with open(cert_output, "w") as f:
145+
f.write(order.fullchain_pem)
146+
finally:
147+
cleanup()
158148

159149
return order
160150

test/config-next/nonce-a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"sampleratio": 1
1414
},
1515
"grpc": {
16-
"maxConnectionAge": "30s",
16+
"maxConnectionAge": "30m",
1717
"services": {
1818
"nonce.NonceService": {
1919
"clientNames": [

test/config-next/nonce-b.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"sampleratio": 1
1414
},
1515
"grpc": {
16-
"maxConnectionAge": "30s",
16+
"maxConnectionAge": "30m",
1717
"services": {
1818
"nonce.NonceService": {
1919
"clientNames": [

test/config/nonce-a.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"debugAddr": ":8111",
1212
"grpc": {
13-
"maxConnectionAge": "30s",
13+
"maxConnectionAge": "30m",
1414
"address": ":9101",
1515
"services": {
1616
"nonce.NonceService": {

test/config/nonce-b.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"debugAddr": ":8111",
1212
"grpc": {
13-
"maxConnectionAge": "30s",
13+
"maxConnectionAge": "30m",
1414
"address": ":9101",
1515
"services": {
1616
"nonce.NonceService": {

0 commit comments

Comments
 (0)