WMSServer' object has no attribute 'hsec_layer_registry'

Issue #270 resolved
Reimar Bauer created an issue

The current 1.6 development version sometimes shows this failure on the staging demo system for demodata

[Mon Sep 04 16:57:14.898991 2017] [wsgi:error] [pid 17796:tid 140405145892608] ERROR:root:<type 'exceptions.AttributeError'>: 'WMSServer' object has no attribute 'hsec_layer_registry'
[Mon Sep 04 16:57:14.899955 2017] [wsgi:error] [pid 17796:tid 140405145892608] Traceback (most recent call last):
[Mon Sep 04 16:57:14.899963 2017] [wsgi:error] [pid 17796:tid 140405145892608]   File "/path/miniconda2/envs/stable/lib/python2.7/site-packages/mslib/mswms/wms.py", line 534, in application
[Mon Sep 04 16:57:14.899967 2017] [wsgi:error] [pid 17796:tid 140405145892608]     return_data, return_format = app.produce_plot(environ, request)
[Mon Sep 04 16:57:14.899971 2017] [wsgi:error] [pid 17796:tid 140405145892608]   File "/path/miniconda2/envs/stable/lib/python2.7/site-packages/mslib/mswms/wms.py", line 375, in produce_plot
[Mon Sep 04 16:57:14.899975 2017] [wsgi:error] [pid 17796:tid 140405145892608]     if (dataset not in self.hsec_layer_registry) or \\
[Mon Sep 04 16:57:14.899979 2017] [wsgi:error] [pid 17796:tid 140405145892608] AttributeError: 'WMSServer' object has no attribute 'hsec_layer_registry'
[Mon Sep 04 16:57:14.899982 2017] [wsgi:error] [pid 17796:tid 140405145892608] 

Comments (3)

  1. Joern Ungermann

    The problem occurs as the server maintains several independent threads. The following occurs

    1) starting two servers threads A and B 2) client call get_capability. thread A is selected to serve the request. hsec_layer_registry is setup in A 3) client calls get_map. Thread B is selected to serve the request - > error occurs as hsec_layer_registry is not setup in B 4) client calls get_map. Thread A is selected to serve the request - > map is generated 5) client calls get_map. Thread B is selected to serve the request - > error occurs as hsec_layer_registry is not setup in B ...

    The problem is that we just introduced "state" to the servers that depends on the call history. We need to either synchronize the capabilities over the threads or rewrite the code that the behaviour of the server is independent on the call history. I favour the second approach.

  2. Log in to comment