Open chriskessel opened 6 years ago
If I have 2 threads try to create a channel simultaneously, sometimes one of them will get back a 409.
It's been easiest to cause in Java, but here's the error, and following that a simple bash script that caused it to happen once every few runs.
< HTTP/1.1 409 Conflict < Date: Tue, 13 Mar 2018 17:31:21 GMT < Content-Type: application/json
100 121 0 48 100 73 201 305 --:--:-- --:--:-- --:--:-- 306
set -x
curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & sleep 10
If I have 2 threads try to create a channel simultaneously, sometimes one of them will get back a 409.
It's been easiest to cause in Java, but here's the error, and following that a simple bash script that caused it to happen once every few runs.
< HTTP/1.1 409 Conflict < Date: Tue, 13 Mar 2018 17:31:21 GMT < Content-Type: application/json
100 121 0 48 100 73 201 305 --:--:-- --:--:-- --:--:-- 306
!/usr/bin/env bash
set -x
curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & curl -v -X PUT --header "Content-Type: application/json" --data '{"owner":"foo", "name":"crktest", "description": "foobar", "ttlDays":"1"}' "http://hub.iad.staging.flightstats.io/channel/crktest" >> foo.txt 2>&1 & sleep 10