Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout #38

Merged
merged 23 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ec63e48
Added select timeouts for unlynx protocols
JoaoAndreSa Mar 10, 2020
b0d3547
Added select timeouts for unlynx protocols/utils
JoaoAndreSa Mar 10, 2020
66925ca
Added select timeouts for unlynx services and simulations
JoaoAndreSa Mar 10, 2020
17479ba
Updated libraries except Onet
JoaoAndreSa Mar 10, 2020
2c8b8bd
Removed break and re-adding race flag
JoaoAndreSa Mar 11, 2020
3281921
Re-added simulation tests
JoaoAndreSa Mar 11, 2020
3dcc5b4
Changed timeouts to use os.Getenv
JoaoAndreSa Mar 11, 2020
abbe277
Added init() for timeout
JoaoAndreSa Mar 11, 2020
3a7f339
Fixed init() in constants.go mistake in condition
JoaoAndreSa Mar 11, 2020
5564657
Added warning while parsing timeout
JoaoAndreSa Mar 11, 2020
3031cda
Removed error condition around tn.SetConfig
JoaoAndreSa Mar 11, 2020
31c25d5
Removed unecessary if condition when sending empty structs
JoaoAndreSa Mar 11, 2020
8861342
Switched from errors.new to fmt.Errorf
JoaoAndreSa Mar 11, 2020
f3812c3
Remove the isLeaf condition for the SendToChildren call
JoaoAndreSa Mar 11, 2020
5bc1e5d
Changed TIMEOUT constant to DEFAULT_TIMEOUT
JoaoAndreSa Mar 12, 2020
186b6f4
Fixed go lint warning
JoaoAndreSa Mar 12, 2020
8563eee
Revert name to TIMEOUT because of golang naming convention (to avoid …
JoaoAndreSa Mar 12, 2020
a4d36eb
Cleaned some of the tmp variables
JoaoAndreSa Mar 12, 2020
c5dddb8
Corrected if negative conditions
JoaoAndreSa Mar 12, 2020
7f37465
Added error condition of tn.SetConfig for debug
JoaoAndreSa Mar 12, 2020
6340084
Fixed tn.SetConfig bug
JoaoAndreSa Mar 12, 2020
e9c05b5
Merge branch 'dev' of https://github.com/ldsec/unlynx into timeout
JoaoAndreSa Mar 12, 2020
e5509ba
Reverted if conditions to the correct way
JoaoAndreSa Mar 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_lint:
}

test_local:
go test -v -race -short -p=1 ./...
go test -v -short -p=1 ./...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a dangerous change! You should be more concerned to change the tests so that they don't time-out. The -race saved us on numerous occasions, so if you decide to really go without it, I'd make sure that the other members of the team are OK with it.

Copy link
Contributor Author

@JoaoAndreSa JoaoAndreSa Mar 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I removed the race because while I was updating onet I started having this error for the simulations that only disappears after removing the -race flag. I'm not sure where is this coming from :/ Trying to debug what is the problem so I can re-add the flag.

Screenshot 2020-03-11 at 10 04 45

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plot thickens... apparently this only happens locally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is bbolt's error in conjunction with the latest go. Are you already using go 1.14?

@tharvik - what is the state of bbolt and the latest go?

Copy link
Contributor Author

@JoaoAndreSa JoaoAndreSa Mar 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. If it's the case I can go back to a previous version (which I did and it works)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ineiti bbolt is still broken, we need etcd-io/bbolt#201 before updating onet/cothority (but containerd and kubernetes both waits on that, it will be fixed in a matter of days)


test_codecov:
./coveralls.sh
Expand Down
14 changes: 11 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
module github.com/ldsec/unlynx

go 1.14

require (
github.com/BurntSushi/toml v0.3.1
github.com/Knetic/govaluate v3.0.0+incompatible
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/fanliao/go-concurrentMap v0.0.0-20141114143905-7d2d7a5ea67b
github.com/gorilla/websocket v1.4.1 // indirect
github.com/montanaflynn/stats v0.6.3 // indirect
github.com/r0fls/gostats v0.0.0-20180711082619-e793b1fda35c
github.com/satori/go.uuid v1.2.0
github.com/stretchr/testify v1.3.0
github.com/urfave/cli v1.22.1
go.dedis.ch/kyber/v3 v3.0.5
github.com/stretchr/testify v1.4.0
github.com/urfave/cli v1.22.3
go.dedis.ch/kyber/v3 v3.0.12
go.dedis.ch/onet/v3 v3.0.24
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 // indirect
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
)

//replace go.dedis.ch/onet/v3 => ../../../go.dedis.ch/onet
30 changes: 30 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8L
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand All @@ -18,11 +20,15 @@ github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkY
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/montanaflynn/stats v0.5.0 h1:2EkzeTSqBB4V4bJwWrt5gIIrZmpJBcoIRGS2kWLgzmk=
github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.6.3 h1:F8446DrvIF5V5smZfZ8K9nrmmix0AFgevPdLruGOmzk=
github.com/montanaflynn/stats v0.6.3/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -39,8 +45,13 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v0.0.0-20190311161405-34c6fa2dc709/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU=
github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
go.dedis.ch/fixbuf v1.0.3 h1:hGcV9Cd/znUxlusJ64eAlExS+5cJDIyTyEG+otu5wQs=
go.dedis.ch/fixbuf v1.0.3/go.mod h1:yzJMt34Wa5xD37V5RTdmp38cz3QhMagdGoem9anUalw=
go.dedis.ch/kyber/v3 v3.0.0-pre2/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ=
Expand All @@ -51,18 +62,25 @@ go.dedis.ch/kyber/v3 v3.0.2/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhs
go.dedis.ch/kyber/v3 v3.0.4/go.mod h1:OzvaEnPvKlyrWyp3kGXlFdp7ap1VC6RkZDTaPikqhsQ=
go.dedis.ch/kyber/v3 v3.0.5 h1:BpjX6vY1R3b7TnJ0mUnCFRVXEJThSAj1zQzmNh4v+70=
go.dedis.ch/kyber/v3 v3.0.5/go.mod h1:V1z0JihG9+dUEUCKLI9j9tjnlIflBw3wx8UOg0g3Pnk=
go.dedis.ch/kyber/v3 v3.0.9/go.mod h1:rhNjUUg6ahf8HEg5HUvVBYoWY4boAafX8tYxX+PS+qg=
go.dedis.ch/kyber/v3 v3.0.12 h1:15d61EyBcBoFIS97kS2c/Vz4o3FR8ALnZ2ck9J/ebYM=
go.dedis.ch/kyber/v3 v3.0.12/go.mod h1:kXy7p3STAurkADD+/aZcsznZGKVHEqbtmdIzvPfrs1U=
go.dedis.ch/onet/v3 v3.0.0 h1:haBqkwkNNu/jHz7+PoZJS+xbtA5JheQvt0SSIjGyk5I=
go.dedis.ch/onet/v3 v3.0.0/go.mod h1:xqmP2+NvxeNzgmNj/4hf56EZm3KT0Qksz98miZw5G3A=
go.dedis.ch/onet/v3 v3.0.4 h1:sIHdiuhg5LMVVDAKQbSiBZsQnJGP2EDxImcp12OnWKo=
go.dedis.ch/onet/v3 v3.0.24 h1:DjPcMDgQgQdxi6Z6vHt3BSuKtZioDUHpIUEC9wQ9NmI=
go.dedis.ch/onet/v3 v3.0.24/go.mod h1:JhOZn9nJgpvxQWiY7Uebjj1AdXTW0ksQyq8RocRhwPk=
go.dedis.ch/onet/v3 v3.1.1 h1:DN0t3Qj611kUrdmNn5quhWDdite1bxhoqoPna8IAWS0=
go.dedis.ch/onet/v3 v3.1.1/go.mod h1:dDV7bRKbT3LJ7enHBcys2O0jXEY2jTUB4dq8HtekGbA=
go.dedis.ch/protobuf v1.0.5/go.mod h1:eIV4wicvi6JK0q/QnfIEGeSFNG0ZeB24kzut5+HaRLo=
go.dedis.ch/protobuf v1.0.6 h1:E61p2XjYbYrTf3WeXE8M8Ui5WA3hX/NgbHHi5D0FLxI=
go.dedis.ch/protobuf v1.0.6/go.mod h1:YHYXW6dQ9p2iJ3f+2fxKnOpjGx0MvL4cwpg1RVNXaV8=
go.dedis.ch/protobuf v1.0.7 h1:wRUEiq3u0/vBhLjcw9CmAVrol+BnDyq2M0XLukdphyI=
go.dedis.ch/protobuf v1.0.7/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4=
go.dedis.ch/protobuf v1.0.8 h1:lmyHigYqVxoTN1V0adoGPvqSdjycAMK0XmTFjP893mA=
go.dedis.ch/protobuf v1.0.8/go.mod h1:pv5ysfkDX/EawiPqcW3ikOxsL5t+BqnV6xHSmE79KI4=
go.dedis.ch/protobuf v1.0.11 h1:FTYVIEzY/bfl37lu3pR4lIj+F9Vp1jE8oh91VmxKgLo=
go.dedis.ch/protobuf v1.0.11/go.mod h1:97QR256dnkimeNdfmURz0wAMNVbd1VmLXhG1CrTYrJ4=
go.etcd.io/bbolt v1.3.0 h1:oY10fI923Q5pVCVt1GBTZMn8LHo5M+RCInFpeMnV4QI=
go.etcd.io/bbolt v1.3.0/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
Expand All @@ -71,25 +89,36 @@ golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b h1:Elez2XeF2p9uyVj0yEUDqQ
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f h1:hX65Cu3JDlGH3uEdK7I99Ii+9kjD6mvnnpfLdEAH0x4=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20191021144547-ec77196f6094/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e h1:3GIlrlVLfkoipSReOMNAgApI0ajnalyLa/EZHHca/XI=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 h1:uYVVQ9WP/Ds2ROhcaGPeIdVq0RIXVLwsHlnvJ+cT1So=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5 h1:ZcPpqKMdoZeNQ/4GHlyY4COf8n8SmpPv6mcqF1+VPSM=
golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/satori/go.uuid.v1 v1.2.0 h1:AH9uksa7bGe9rluapecRKBCpZvxaBEyu0RepitcD0Hw=
Expand All @@ -99,6 +128,7 @@ gopkg.in/tylerb/graceful.v1 v1.2.15/go.mod h1:yBhekWvR20ACXVObSSdD3u6S9DeSylanL2
gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0=
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
rsc.io/goversion v1.2.0 h1:SPn+NLTiAG7w30IRK/DKp1BjvpWabYgxlLp/+kx5J8w=
rsc.io/goversion v1.2.0/go.mod h1:Eih9y/uIBS3ulggl7KNJ09xGSLcuNaLgmvvqa07sgfo=
18 changes: 14 additions & 4 deletions protocols/collective_aggregation_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package protocolsunlynx
import (
"errors"
"sync"
"time"

"github.com/ldsec/unlynx/lib"
"github.com/ldsec/unlynx/lib/aggregation"
Expand Down Expand Up @@ -106,6 +107,8 @@ type CollectiveAggregationProtocol struct {
Proofs bool
ProofFunc proofCollectiveAggregationFunction // proof function for when we want to do something different with the proofs (e.g. insert in the blockchain)
MapPIs map[string]onet.ProtocolInstance // protocol instances to be able to call protocols inside protocols (e.g. proof_collection_protocol)

Timeout time.Duration
}

// NewCollectiveAggregationProtocol initializes the protocol instance.
Expand All @@ -129,6 +132,9 @@ func NewCollectiveAggregationProtocol(n *onet.TreeNodeInstance) (onet.ProtocolIn
return nil, errors.New("couldn't register data reference channel: " + err.Error())
}

// default timeout
pap.Timeout = 10 * time.Minute

return pap, nil
}

Expand Down Expand Up @@ -195,11 +201,15 @@ func (p *CollectiveAggregationProtocol) Dispatch() error {

// Announce forwarding down the tree.
func (p *CollectiveAggregationProtocol) aggregationAnnouncementPhase() error {
dataReferenceMessage := <-p.DataReferenceChannel
if !p.IsLeaf() {
if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
select {
case dataReferenceMessage := <-p.DataReferenceChannel:
if !p.IsLeaf() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneded if, SendToChildren when having none should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arf, I misexplained it; the if !p.IsLeaf() is unnecessary, as a Leaf sending to it's children is a NOP.
And you're droping the error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh I did not get it :P
Ok it's fixed: f3812c3

if err := p.SendToChildren(&dataReferenceMessage.DataReferenceMessage); err != nil {
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the new fmt.Errorf when returning error (it will also keep the stacktrace).

Suggested change
return errors.New("Error sending <DataReferenceMessage>:" + err.Error())
return fmt.Errorf("Error sending <DataReferenceMessage>: %v", err)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched everywhere to fmt.Errorf: 8861342

}
}
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <dataReferenceMessage> on time.")
}
return nil
}
Expand Down
23 changes: 21 additions & 2 deletions protocols/deterministic_tagging_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type DeterministicTaggingProtocol struct {
Proofs bool

ExecTime time.Duration

Timeout time.Duration
}

// NewDeterministicTaggingProtocol constructs tagging switching protocol instances.
Expand All @@ -117,6 +119,9 @@ func NewDeterministicTaggingProtocol(n *onet.TreeNodeInstance) (onet.ProtocolIns
}
}

// default timeout
dsp.Timeout = 10 * time.Minute

return dsp, nil
}

Expand Down Expand Up @@ -156,7 +161,14 @@ func (p *DeterministicTaggingProtocol) Dispatch() error {
defer p.Done()

//************ ----- first round, add value derivated from ephemeral secret to message ---- ********************
deterministicTaggingTargetBytesBef := <-p.PreviousNodeInPathChannel
var deterministicTaggingTargetBytesBef deterministicTaggingBytesStruct
select {
case deterministicTaggingTargetBytesBef = <-p.PreviousNodeInPathChannel:
break
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <deterministicTaggingTargetBytesBef> (first round) on time.")
}

deterministicTaggingTargetBef := DeterministicTaggingMessage{Data: make([]libunlynx.CipherText, 0)}
err := deterministicTaggingTargetBef.FromBytes(deterministicTaggingTargetBytesBef.Data)
if err != nil {
Expand Down Expand Up @@ -203,7 +215,14 @@ func (p *DeterministicTaggingProtocol) Dispatch() error {
}

//************ ----- second round, deterministic tag creation ---- ********************
deterministicTaggingTargetBytes := <-p.PreviousNodeInPathChannel
var deterministicTaggingTargetBytes deterministicTaggingBytesStruct
select {
case deterministicTaggingTargetBytes = <-p.PreviousNodeInPathChannel:
break
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <deterministicTaggingTargetBytes> (second round) on time.")
}

deterministicTaggingTarget := DeterministicTaggingMessage{Data: make([]libunlynx.CipherText, 0)}
err = deterministicTaggingTarget.FromBytes(deterministicTaggingTargetBytes.Data)
if err != nil {
Expand Down
14 changes: 13 additions & 1 deletion protocols/key_switching_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ type KeySwitchingProtocol struct {

// Test (only use in order to test the protocol)
ExecTime time.Duration

Timeout time.Duration
}

// NewKeySwitchingProtocol initializes the protocol instance.
Expand All @@ -137,6 +139,9 @@ func NewKeySwitchingProtocol(n *onet.TreeNodeInstance) (onet.ProtocolInstance, e
return nil, errors.New("couldn't register length channel: " + err.Error())
}

// default timeout
pap.Timeout = 10 * time.Minute

return pap, nil
}

Expand Down Expand Up @@ -230,7 +235,14 @@ func (p *KeySwitchingProtocol) Dispatch() error {

// Announce forwarding down the tree.
func (p *KeySwitchingProtocol) announcementKSPhase() (kyber.Point, []kyber.Point, error) {
dataReferenceMessage := <-p.DownChannel
var dataReferenceMessage DownBytesStruct
select {
case dataReferenceMessage = <-p.DownChannel:
break
case <-time.After(p.Timeout):
return nil, nil, errors.New(p.ServerIdentity().String() + "didn't get the <dataReferenceMessage> on time.")
}

if !p.IsLeaf() {
if err := p.SendToChildren(&dataReferenceMessage.DownMessageBytes); err != nil {
return nil, nil, errors.New("Node " + p.ServerIdentity().String() + " failed to broadcast DownMessageBytes: " + err.Error())
Expand Down
24 changes: 22 additions & 2 deletions protocols/shuffling+ddt_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package protocolsunlynx
import (
"errors"
"sync"
"time"

"github.com/ldsec/unlynx/lib"
"github.com/ldsec/unlynx/lib/deterministic_tag"
Expand Down Expand Up @@ -81,6 +82,8 @@ type ShufflingPlusDDTProtocol struct {

// Proofs
Proofs bool

Timeout time.Duration
}

// NewShufflingPlusDDTProtocol constructs neff shuffle + ddt protocol instance.
Expand All @@ -106,6 +109,10 @@ func NewShufflingPlusDDTProtocol(n *onet.TreeNodeInstance) (onet.ProtocolInstanc
break
}
}

// default timeout
pi.Timeout = 10 * time.Minute

return pi, nil
}

Expand Down Expand Up @@ -152,8 +159,21 @@ func (p *ShufflingPlusDDTProtocol) Start() error {
func (p *ShufflingPlusDDTProtocol) Dispatch() error {
defer p.Done()

shufflingPlusDDTBytesMessageLength := <-p.LengthNodeChannel
tmp := <-p.PreviousNodeInPathChannel
var shufflingPlusDDTBytesMessageLength shufflingPlusDDTBytesLengthStruct
select {
case shufflingPlusDDTBytesMessageLength = <-p.LengthNodeChannel:
break
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <shufflingPlusDDTBytesMessageLength> on time.")
}

var tmp shufflingPlusDDTBytesStruct
select {
case tmp = <-p.PreviousNodeInPathChannel:
break
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <tmp> on time.")
}

readData := libunlynx.StartTimer(p.Name() + "_ShufflingPlusDDT(ReadData)")
sm := ShufflingPlusDDTMessage{}
Expand Down
23 changes: 21 additions & 2 deletions protocols/shuffling_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type ShufflingProtocol struct {
CollectiveKey kyber.Point
ExecTimeStart time.Duration
ExecTime time.Duration

Timeout time.Duration
}

// NewShufflingProtocol constructs neff shuffle protocol instances.
Expand All @@ -116,6 +118,10 @@ func NewShufflingProtocol(n *onet.TreeNodeInstance) (onet.ProtocolInstance, erro
break
}
}

// default timeout
dsp.Timeout = 10 * time.Minute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How has this timeout been chosen?

Why are there different timeouts?

Shouldn't it be possible to change the timeout, e.g., with an environment variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no rule to chose the timeout. I just chose enough time for it not to fail in normal query scenarios. As for the timeouts I added one for each different protocol or service. This way we can pass it when calling the protocol or service. You think an environment variable would be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends (as always):

  • do you trust the leader to not send a malicious timeout that will keep your resources? (I suppose yes)
  • do you want to have each node decide on his own timeouts? (I suppose no)

So with a yes - no answer, I think you're doing the right thing ;)

But instead of hardcoding the timeout, I'd use https://golang.org/pkg/os/#Getenv to read the MEDCO_TIMEOUT environment variable, and, if it is not set, use a globally defined timeout.

Timeouts are always hard to get right (even @bford said "good luck" when I had to do it ;), so having them easily adjustable also from the outside is a plus!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ineiti I followed your suggestion and changed the timeouts 3dcc5b4
Would this be better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, looks good to me.


return dsp, nil
}

Expand Down Expand Up @@ -186,9 +192,22 @@ func (p *ShufflingProtocol) Start() error {
func (p *ShufflingProtocol) Dispatch() error {
defer p.Done()

shufflingBytesMessageLength := <-p.LengthNodeChannel
var shufflingBytesMessageLength shufflingBytesLengthStruct
select {
case shufflingBytesMessageLength = <-p.LengthNodeChannel:
break
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <shufflingBytesMessageLength> on time.")
}

var tmp shufflingBytesStruct
select {
case tmp = <-p.PreviousNodeInPathChannel:
break
case <-time.After(p.Timeout):
return errors.New(p.ServerIdentity().String() + "didn't get the <tmp> on time.")
}

tmp := <-p.PreviousNodeInPathChannel
sm := ShufflingMessage{}
if err := sm.FromBytes(tmp.Data, shufflingBytesMessageLength.CVLengths); err != nil {
return err
Expand Down
Loading