- 
    Type:Bug 
- 
    Resolution: Cannot Reproduce
- 
    Priority:Major - P3 
- 
    Affects Version/s: 3.4
- 
    Component/s: None
- 
    Environment:Azure Server:
 
 $ cat /etc/*release
 DISTRIB_ID=Ubuntu
 DISTRIB_RELEASE=16.04
 DISTRIB_CODENAME=xenial
 DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
 NAME="Ubuntu"
 VERSION="16.04.2 LTS (Xenial Xerus)"
 ID=ubuntu
 ID_LIKE=debian
 PRETTY_NAME="Ubuntu 16.04.2 LTS"
 VERSION_ID="16.04"
 HOME_URL="http://www.ubuntu.com/"
 SUPPORT_URL="http://help.ubuntu.com/"
 BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
 VERSION_CODENAME=xenial
 UBUNTU_CODENAME=xenial
 
 $ lscpu
 Architecture: x86_64
 CPU op-mode(s): 32-bit, 64-bit
 Byte Order: Little Endian
 CPU(s): 8
 On-line CPU(s) list: 0-7
 Thread(s) per core: 1
 Core(s) per socket: 8
 Socket(s): 1
 NUMA node(s): 1
 Vendor ID: GenuineIntel
 CPU family: 6
 Model: 63
 Model name: Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
 Stepping: 2
 CPU MHz: 2394.431
 BogoMIPS: 4788.86
 Hypervisor vendor: Microsoft
 Virtualization type: full
 L1d cache: 32K
 L1i cache: 32K
 L2 cache: 256K
 L3 cache: 30720K
 NUMA node0 CPU(s): 0-7
 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms xsaveoptAzure Server: $ cat /etc/*release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS" NAME="Ubuntu" VERSION="16.04.2 LTS (Xenial Xerus)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 16.04.2 LTS" VERSION_ID="16.04" HOME_URL=" http://www.ubuntu.com/ " SUPPORT_URL=" http://help.ubuntu.com/ " BUG_REPORT_URL=" http://bugs.launchpad.net/ubuntu/ " VERSION_CODENAME=xenial UBUNTU_CODENAME=xenial $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 On-line CPU(s) list: 0-7 Thread(s) per core: 1 Core(s) per socket: 8 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 63 Model name: Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz Stepping: 2 CPU MHz: 2394.431 BogoMIPS: 4788.86 Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 30720K NUMA node0 CPU(s): 0-7 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase bmi1 avx2 smep bmi2 erms xsaveopt
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
uwsgi setup on every 4 minutes reload (it's important)
Connect to MongoDB via register_connection:
mongo_db = 
Sometime after reload read operation give error:
Traceback (most recent call last):
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1997, in _call_
    return self.wsgi_app(environ, start_response)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/werkzeug/contrib/fixers.py", line 152, in _call_
    return self.app(environ, start_response)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./tools/utils.py", line 158, in view_func
    return f(*args, **kwargs)
  File "./bproute/tools.py", line 369, in get_main_statistics
    tenders_num_total = TenderRequest.objects(Q(is_confirmed=True)).count() or 1
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/mongoengine/queryset/manager.py", line 37, in _get_
    queryset = queryset_class(owner, owner._get_collection())
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/mongoengine/document.py", line 206, in _get_collection
    cls.ensure_indexes()
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/mongoengine/document.py", line 836, in ensure_indexes
    collection.create_index(fields, background=background, **opts)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/collection.py", line 1529, in create_index
    self.__create_index(keys, kwargs)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/collection.py", line 1417, in __create_index
    with self._socket_for_writes() as sock_info:
  File "/usr/lib/python2.7/contextlib.py", line 17, in _enter_
    return self.gen.next()
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/mongo_client.py", line 823, in _get_socket
    server = self._get_topology().select_server(selector)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/topology.py", line 214, in select_server
    address))
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/topology.py", line 202, in select_servers
    selector, address)
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/topology_description.py", line 211, in apply_selector
    selector(Selection.from_topology_description(self)))
  File "/home/sudoaccess/backend/lib/python2.7/site-packages/pymongo/topology_description.py", line 188, in apply_local_threshold
    if (s.round_trip_time - fastest) <= threshold]
TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'
[pid: 5747|app: 0|req: 1/6] 52.169.30.199 () 
[Wed Apr 26 22:12:12 2017] GET /api/v1/tools/main_statistics => generated 0 bytes in 0 msecs (HTTP/1.1 500) 0 headers in 0 bytes (0 switches on core 0)
- is fixed by
- 
                    PYTHON-4298 Raise informative error when server_description.round_trip_time is None in server selection -         
- Closed
 
-         
- is related to
- 
                    PYTHON-4600 bugfix: handle round trip time being negative because time.monotonic() is not monotonic #1758 -         
- Closed
 
-