usnistgov / SpectrumBrowser

ITL
12 stars 11 forks source link

When running live streaming, I get an error on the DataStreaming.py terminal #166

Closed jkubNTIA closed 9 years ago

jkubNTIA commented 9 years ago
  1. I am running live streaming by typing the following at the terminal: python DataStreaming.py&
  2. On another terminal, I type: python unit-tests/test-streaming-socket.py -data ../../DataSpectrumBrowser/LTE_UL_bc17_ts109_stream_30m.dat I see the following on the terminal:
  3. On the DataStreaming.py terminal, I see the following messages (works for awhile and then gives an error - see the bottom of the log messages - and the spectogram on the web browser becomes black without data): ConnectionMaintainer Starting streaming server Trying port 9000 OccupancyServer: Accepting connections { "Alt": 143.5, "Lat": 39.134375, "Lon": -77.215337, "Mobility": "Stationary", "SensorID": "ECR16W4XS", "SensorKey": "NaN", "TimeZone": "America/New_York", "Type": "Loc", "Ver": "1.0.9", "_localDbInsertionTime": 1430313680.291269, "t": 1413576259 } Location Post already exists - not updating pubsubPort 10000 Key = lastDataMessage_ECR16W4XS { "ByteOrder": "N/A", "Comment": "Using hard-coded (not detected) system noise power for wnI", "Compression": "None", "DataType": "Binary - int8", "OL": "NaN", "Processed": "False", "SensorID": "ECR16W4XS", "SensorKey": "NaN", "Sys2Detect": "LTE", "Ta": 3600.0, "Type": "Data", "Ver": "1.0.9", "_dataKey": "5540dadabd45d41812d01410", "_localDbInsertionTime": 1430313690.387972, "_occupancyKey": "5540dadabd45d41812d01414", "_occupancyStartTime": 1430313680.330121, "_occupancyVectorLength": 200, "_spectrumsPerFrame": 50, "a": 1, "cutoff": -75, "freqRange": "LTE:703967500:714047500", "locationMessageId": "552340febd45d4178a5f8cbd", "mPar": { "Atten": 38.0, "Det": "Average", "fStart": 703967500.0, "fStop": 714047500.0, "n": 56, "td": 10, "tm": 0.001 }, "mType": "FFT-Power", "maxOccupancy": 0.96, "maxPower": -37, "meanOccupancy": 0.04, "medianOccupancy": 0.0, "minOccupancy": 0.0, "minPower": -80, "nM": 10000.0, "seqNo": 1517, "streamingFilter": "MAX_HOLD", "systemMessageId": "55341492bd45d41200887d99", "t": 1413576269, "t1": 1413576259, "wnI": -77.0 } Insertion time 0.33297419548 { "ByteOrder": "N/A", "Comment": "Using hard-coded (not detected) system noise power for wnI", "Compression": "None", "DataType": "Binary - int8", "OL": "NaN", "Processed": "False", "SensorID": "ECR16W4XS", "SensorKey": "NaN", "Sys2Detect": "LTE", "Ta": 3600.0, "Type": "Data", "Ver": "1.0.9", "_dataKey": "5540de68bd45d41abed01410", "_localDbInsertionTime": 1430314600.705799, "_occupancyKey": "5540de68bd45d41abed01414", "_occupancyStartTime": 1430313690.385414, "_occupancyVectorLength": 17939, "_spectrumsPerFrame": 50, "a": 1, "cutoff": -75, "freqRange": "LTE:703967500:714047500", "locationMessageId": "552340febd45d4178a5f8cbd", "mPar": { "Atten": 38.0, "Det": "Average", "fStart": 703967500.0, "fStop": 714047500.0, "n": 56, "td": 10, "tm": 0.001 }, "mType": "FFT-Power", "maxOccupancy": 0.92, "maxPower": -46, "meanOccupancy": 0.01, "medianOccupancy": 0.0, "minOccupancy": 0.0, "minPower": -80, "nM": 10000.0, "seqNo": 1518, "streamingFilter": "MAX_HOLD", "systemMessageId": "55341492bd45d41200887d99", "t": 1413577179, "t1": 1413576259, "wnI": -77.0 } Insertion time 0.345461130142 { "ByteOrder": "N/A", "Comment": "Using hard-coded (not detected) system noise power for wnI", "Compression": "None", "DataType": "Binary - int8", "OL": "NaN", "Processed": "False", "SensorID": "ECR16W4XS", "SensorKey": "NaN", "Sys2Detect": "LTE", "Ta": 3600.0, "Type": "Data", "Ver": "1.0.9", "_dataKey": "5540e1f6bd45d41d66d01410", "_localDbInsertionTime": 1430315510.942847, "_occupancyKey": "5540e1f6bd45d41d66d01414", "_occupancyStartTime": 1430314600.702249, "_occupancyVectorLength": 17834, "_spectrumsPerFrame": 50, "a": 1, "cutoff": -75, "freqRange": "LTE:703967500:714047500", "locationMessageId": "552340febd45d4178a5f8cbd", "mPar": { "Atten": 38.0, "Det": "Average", "fStart": 703967500.0, "fStop": 714047500.0, "n": 56, "td": 10, "tm": 0.001 }, "mType": "FFT-Power", "maxOccupancy": 0.17, "maxPower": -53, "meanOccupancy": 0.0, "medianOccupancy": 0.0, "minOccupancy": 0.0, "minPower": -80, "nM": 10000.0, "seqNo": 1519, "streamingFilter": "MAX_HOLD", "systemMessageId": "55341492bd45d41200887d99", "t": 1413578089, "t1": 1413576259, "wnI": -77.0 } Insertion time 0.333391904831 Unexpected error: <class 'struct.error'> (<class 'struct.error'>, error('unpack requires a string argument of length 1',), <traceback object at 0x7fafb42ad098>) Traceback (most recent call last): File "DataStreaming.py", line 243, in readByte retval = struct.unpack(">b", val)[0] error: unpack requires a string argument of length 1 val =
    Unexpected error: <class 'struct.error'> (<class 'struct.error'>, error('unpack requires a string argument of length 1',), <traceback object at 0x7fafb42c9290>) Traceback (most recent call last): File "DataStreaming.py", line 580, in readFromInput data = bbuf.readByte() File "DataStreaming.py", line 243, in readByte retval = struct.unpack(">b", val)[0] error: unpack requires a string argument of length 1 Closing pub socket
ranganathanm commented 9 years ago

I just print out the exception when the sensor disconnects. I also print out the DataMessage before posting this to the database. Neither are error messages as such. However, they shoud be written out to the log file.

jkubNTIA commented 9 years ago

Streaming seems to work with the new master branch. However, I do see the following in the gunicorn terminal window (no issues on the browser, just these messages on the terminal window): Traceback (most recent call last): File "/home/jkub/Documents/SpectrumBrowser/flask/DataStreaming.py", line 481, in getSensorData ws.send(sensordata[sensorId]) File "/usr/local/lib/python2.7/dist-packages/geventwebsocket/websocket.py", line 348, in send raise WebSocketError(MSG_SOCKET_DEAD) WebSocketError: Socket is dead

ranganathanm commented 9 years ago

That is just a logging message. It is an expected behavior. It indicates that the web server has closed the socket. I can move it to the log file.

ranganathanm commented 9 years ago

Closing as the implementation has been changed. You will still see a stack trace when the web server navigates away from the streaming page.