android - Pubnub+Python SDK on an Ubuntu Azure-hosted machine. Connection problems -


i experiencing bad behavior of pubnub in following scenario:

  1. pubnub sdk python subscriber
  2. python 3+django on ubuntu 14.04
  3. ubuntu machine hosted on azure
  4. android pubnub client publisher

it seems that, @ point, pubnub connection on server side becomes stale, is, message sent client not received subscriber. have noticed there errors on log related pubnub connection:

warning 2015-09-30 17:21:24,778 connectionpool 26551 139638563919616 retrying (retry(total=0, connect=none, read=none, redirect=none)) after connection broken 'readtimeouterror("httpconnectionpool(host='pubsub.pubnub.com', port=80): read timed out. (read timeout=320)",)': /subscribe/.../.../0/...?uuid=...&auth=...&pnsdk=pubnub-python/3.7.3 

after 5 minutes, message received , correctly processed. guess root of problem lays in way azure manages long http connections, as:

  1. the problem not arise on local machine, has same os version , same stack
  2. there obscure 'azure' parameter in python sdk. tried activate without noticeable difference
  3. as test added 2 more subscribers on pc , both receive messages instaneously

thanks.

it seems root cause fact azure cuts http connections above 4 minutes (https://azure.microsoft.com/it-it/blog/new-configurable-idle-timeout-for-azure-load-balancer/).

on other hand, though, pubnub creates connections 5 minutes timeout (320 seconds, see https://github.com/pubnub/python/blob/master/pubnub.py#l1881).

unfortunately, pubnub 320 seconds timeout can not changed, whereas azure timeout seems modifiable via powershell scripts (uncomfortable, if not have microsoft window machine).

all in all, changed pubnub source code 120 seconds timeout , going pretty well.

it advisable to:

  1. document on pubnub side
  2. modify pubnub 320 seconds timeout can changed
  3. improve azure interface in order change timeout parameter without using powershell

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -