Recurrent websocket error when devices are offline.

Mauro Socci2 years ago

Hi all, sorry for my english. Just a question:
When the device is online and it's set to send the position < 120 secs, websocket is alive and all OK.
When the device is offline, websocket error is shown regularly (every 170 secs about). If the device goes online just after a websocket error, the online event notification comes immediately but the position refresh and the status update requires up to 50 secs. Same delay if the device is online but it's set to send the position > 120 secs.
I've some devices which send the position every 180 secs. Others makes many short trips over the day. So these delays are annoying and confusing. Is it a normal behaviour? Or it's an error/problem somewhere in my config file, server or whatelse? Thanks so much for any clarification or suggestion.

Tested:
Windows Server 2012 R2 X64 (6.2 build 9200).
Java 8 update 361.
Traccar 4.1
Traccar 5.0
Server firewall/antivirus OFF.
Different operators, different WiFi, 4G, 5G, different browsers (Firefox, Brave, Chrome, Edge on windows 7-8.1.10 and Android 10-11).
Also tested with standard http connection (IIS OFF and not configured) and with IIS HTTPS reverse proxy (same behaviour).
No errors shown in Chrome console after WS error appears.

CONFIG:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
  <entry key='web.enable'>true</entry>
  <entry key='web.port'>8088</entry>
  <entry key='web.path'>./web</entry>
  <entry key='web.cacheControl'>max-age=3600,public</entry>
 
  <!--entry key='geocoder.enable'>true</entry-->
  <!--entry key='geocoder.type'>nominatim</entry-->
  <!--entry key='geocoder.url'>https://us1.locationiq.com/v1/reverse.php</entry-->
  <!--entry key='geocoder.key'>xxxxxxxxxxxxx</entry-->    
  <!--entry key='geocoder.reuseDistance'>50</entry-->
    
     <entry key='logger.enable'>true</entry>
    <entry key='logger.level'>info</entry>
    <entry key='logger.file'>./logs/tracker-server.log</entry>
    <entry key='logger.rotate'>true</entry>

    <entry key='filter.enable'>true</entry>
    <entry key='filter.future'>3600</entry>
    <entry key='filter.zero'>true</entry>
    <entry key='filter.invalid'>false</entry>
    <entry key='filter.duplicate'>false</entry>

    <entry key='event.enable'>true</entry>
    <entry key='event.ignoreDuplicateAlerts'>true</entry>
    <entry key='processing.computedAttributes.enable'>true</entry>
    <!--entry key='processing.engineHours.enable'>true</entry-->

    <entry key='media.path'>./media</entry>
    <entry key='server.statistics'>https://www.traccar.org/analytics/</entry>
    <entry key='commands.queueing'>true</entry>

    <entry key='notificator.types'>web,mail,sms</entry>
    <entry key='notificator.sms.manager.class'>org.traccar.sms.HttpSmsClient</entry>
    <entry key='sms.http.url'>https://api.telegram.org/xxxxxxxxxxxxxxx/sendMessage?</entry>
    <entry key='sms.http.user'>[xxxxxxxxxx]</entry>
    <entry key='sms.http.password'>[xxxxxxxxxxx]</entry>
    <entry key='sms.http.template'>
        chat_id=xxxxxxxxxxxxxxxxxxxxxx
    </entry>
        
<!--entry key='sms.smpp.enable'>true</entry-->
<!--entry key='sms.smpp.host'>xxxxxxxxxxxx.com</entry-->
<!--entry key='sms.smpp.port'>xxxx</entry-->
<!--entry key='sms.smpp.username'>xxxxxxxxxxx</entry-->
<!--entry key='sms.smpp.password'>xxxxxxxx</entry-->
<!--entry key='sms.smpp.notificationsCharset'>GSM</entry-->
<!--entry key='sms.smpp.notificationsDataCoding'>0</entry-->
<!--entry key='sms.smpp.sourceAddress'>xxxxxxxxxxxx</entry-->
        
    <!--entry key='status.ignoreOffline'>tk103</entry-->
    <entry key='status.timeout'>900</entry>
    <entry key='tk103.timeout'>3600</entry>
    <entry key='tk102.timeout'>3600</entry>
    <entry key='gps103.timeout'>3600</entry>
    <entry key='xexun.timeout'>3600</entry>
    <entry key='osmand.timeout'>905</entry>

    <!--entry key='web.timeout'>180000</entry-->
          
    <entry key='time.override'>serverTime</entry>
    <entry key='time.protocols'>xexun</entry>
    
    <entry key='tk103.resetDelay'>2880</entry>
    <entry key='tk102.resetDelay'>2880</entry>
    <entry key='gps103.resetDelay'>2880</entry>
    <entry key='xexun.resetDelay'>2880</entry>
    <entry key='osmand.resetDelay'>60</entry>
    
    <entry key='database.ignoreUnknown'>true</entry>
   <entry key='event.statusHandler'>true</entry>    
    <entry key='database.generateQueries'>true</entry>
    <entry key='database.changelog'>./schema/changelog-master.xml</entry>
    <entry key='database.historyDays'>75</entry>
    
    <entry key='report.trip.minimalTripDistance'>180</entry>
    <entry key='report.trip.minimalTripDuration'>180</entry>
    <!--entry key='report.trip.minimalNoDataDuration'>90</entry-->
    <entry key='report.trip.minimalParkingDuration'>90</entry>
    <entry key='status.updateDeviceState'>true</entry>
    
    <entry key='database.loginUser'>
        SELECT * FROM tc_users
        WHERE email = :email OR login = :email
    </entry>

    <entry key='database.selectPositions'>
        SELECT * FROM tc_positions WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime
    </entry>

    <entry key='database.selectLatestPositions'>
        SELECT tc_positions.* FROM tc_positions INNER JOIN tc_devices ON tc_positions.id = tc_devices.positionid;
    </entry>

    <entry key='database.updateLatestPosition'>
        UPDATE tc_devices SET positionId = :id WHERE id = :deviceId
    </entry>

    <entry key='database.selectEvents'>
        SELECT * FROM tc_events WHERE deviceId = :deviceId AND serverTime BETWEEN :from AND :to ORDER BY serverTime
    </entry>

    <entry key='database.deletePositions'>
        DELETE FROM tc_positions WHERE serverTime &lt; :serverTime AND id NOT IN (SELECT positionId FROM tc_devices WHERE positionId IS NOT NULL)
    </entry>

    <entry key='database.deleteEvents'>
        DELETE FROM tc_events WHERE serverTime &lt; :serverTime
    </entry>

    <entry key='database.selectStatistics'>
        SELECT * FROM tc_statistics WHERE captureTime BETWEEN :from AND :to ORDER BY captureTime
    </entry>

    <entry key='gps103.port'>8001</entry>
    <entry key='tk103.port'>8002</entry>
    <entry key='gl100.port'>8003</entry>
    <entry key='gl200.port'>8004</entry>
    <entry key='t55.port'>8005</entry>
    <entry key='xexun.port'>8006</entry>
    <entry key='xexun.extended'>true</entry>
    <entry key='totem.port'>8007</entry>
    <entry key='enfora.port'>8008</entry>
    <entry key='h02.port'>8013</entry>
    <entry key='gt02.port'>8022</entry>
    <entry key='gt06.port'>8023</entry>
    <entry key='teltonika.port'>8027</entry>
    <entry key='galileo.port'>8034</entry>
    <entry key='ywt.port'>8035</entry>
    <entry key='tk102.port'>8036</entry>
    <entry key='wialon.port'>8039</entry>
    <entry key='globalsat.port'>8043</entry>   
    <entry key='osmand.port'>8055</entry>
    <entry key='globalstar.port'>8185</entry>

</properties>
Anton Tananaev2 years ago

Can you please provide a screenshot of the error and of the browser network tools when the error happens.

Mauro Socci2 years ago

I've 9 screenshots so I've loaded here: https://www.flickr.com/photos/197926341@N08/shares/D1e57x5rH9
Hope they are what you asked for.

Here the net websocket info after the error. It's an https ssl connection via reverse proxy on windows server. But the same problem occur also connecting Traccar with http connection (IIS services off and IIS not configured).

Anton Tananaev2 years ago

There's a timeout of 60 seconds. If you don't have any updates in that period, you will get that error.

Mauro Socci2 years ago

Yes it's what happens. And it's what I've searched a lot but I didn't find. Where do you see this setting? It's in traccar config on in windows server? It's possible to increase this timeout up to 150 or 180 secs? Thanks.

Anton Tananaev2 years ago
Mauro Socci2 years ago

Ok I'll try to reduce position interval in all the devices. Thanks.