When quantum server is slow in responding to the port create requests (30 seconds or more) we are seeing duplicate port requests being made for the same operation. This is related to the value set for the quantum_url_timeout parameter (30 seconds by default) and by increasing the value we get duplicate port requests only for those quantum requests taking longer than the new timeout value.
It appears that the quantum client is retrying the request on timeouts and is an error to do it for POST which is non-idempotent and in this case creates duplicate ports. Further investigation of the problem shows that this is coming from the httplib2 library which retries requests on socket time out. https://code.google.com/p/httplib2/issues/detail?id=109
There is a retry logic in httplib2 used by neutron that automatically retries requests. One instance when this kicks in is: client makes a connection —> issues request to the server —> server takes too long to respond (if busy) —> client socket timesout waiting for response and client goes for a retry. The end result is that the request may get processed twice at the server. There is a parameter RETRIES used in _conn_request(…) defined in __init__.py. This parameter is not configurable, hard-coded to 2.
One possible way to deal with this is to increase the timeout value (which is configurable) to a larger value. The default is 30 seconds and increasing it to larger value helps. This will not solve the issue, but could make it less likely to occur.
Here are Google references to the retry logic in httplib2: /code.google. com/p/httplib2/ issues/ detail? id=109 /groups. google. com/forum/ #!msg/google- api-python- client/ VE1d7a7Wevg/ elmt1MDsjmAJ httplib2. googlecode. com/hg/ doc/html/ libhttplib2. html
https:/
https:/
http://