Skip to content

Connection drops during batch post #2160

@C-Loftus

Description

@C-Loftus

Hello,

I am trying to batch insert around ~2000 datastreams however I am having an error each time with the SQL connection internal to FROST and isn't tied to any specific datastream or batch post.

2025-05-19 12:19:38 16:19:38.259 [http-nio-8080-exec-8] ERROR      d.f.i.i.f.service.Service - Failed to handle request (details in debug): SQL [select count(*) from "OBS_PROPERTIES" where "OBS_PROPERTIES"."ID" = ?]; Connection is null.

I can typically connect/batch post fine with an http client so presumably something is failing due to either size or internal timeouts.

I have tried to enable debug logging but there is quite a bit of log spam so I can't sort through it well to determine what the error is.

My own application level logging (i.e. I wrote this myself to trace the payload) outputs a log usually like this

Got error msg: {'id': '1', 'status': 500} when posting batch item: {'id': '1', 'method': 'post', 'url': 'Datastreams', 'body': {'@iot.id': 'LANE0011612', 'name': 'Waterlevel below land surface for well 11612', 'description': 'Type of log: Water Well', 'observationType': 'http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement', 'unitOfMeasurement': {'name': 'feet', 'symbol': 'ft', 'definition': 'https://qudt.org/vocab/unit/FT'}, 'ObservedProperty': {'@iot.id': 77608, 'name': 'Groundwater Depth', 'definition': 'Groundwater depth is the distance between the water surface and the ground surface at a specific location specified by the site location and offset.', 'description': 'Originally from the CUAHSI HIS VariableNameCV. See: http://his.cuahsi.org/mastercvreg/edit_cv11.aspx?tbl=VariableNameCV.', 'properties': {'uri': 'http://vocabulary.odm2.org/api/v1/variablename/groundwaterDepth'}}, 'Sensor': {'@iot.id': 0, 'name': 'Unknown', 'description': 'Unknown', 'encodingType': 'Unknown', 'metadata': 'Unknown'}, 'Thing': {'@iot.id': 'LANE0011612', 'name': 'Well LANE0011612', 'description': 'Well LANE0011612'}}}

I have tried changing the batch size from 50, 200, 500, 800 or 1000 and all fail with the same error but sometimes it is on a different batch, so it doesn't appear to be an issue with a specific payload.

My client code just posts a json to the batch endpoint and isn't using any particularly complex features of the sensorthings spec. I know the batch syntax I wrote is correct since it works in test code with a dummy post to FROST.

I am using a local postgres database and this is my config for my open source project called OWDP

services:
  owdp-frost:
    container_name: owdp-frost
    build:
      context: ./docker/frost
    environment:
      - serviceRootUrl=${OWDP_URL}/FROST-Server
      - persistence_db_url=jdbc:postgresql://owdp-database:5432/sensorthings
      - persistence_db_username=sensorthings
      - persistence_db_password=ChangeMe
      - persistence_autoUpdateDatabase=true
    ports:
      - 1883:1883
      - 8080:8080
    depends_on:
      - owdp-database

  owdp-database:
    container_name: owdp-database
    build:
      context: ./docker/database
    environment:
      - POSTGRES_DB=sensorthings
      - POSTGRES_USER=sensorthings
      - POSTGRES_PASSWORD=ChangeMe
    volumes:
      - postgis_volume:/var/lib/postgresql/data

I am using FROM postgis/postgis:14-3.2-alpine for my db image and this is my dockerfile for Frost;

FROM fraunhoferiosb/frost-server

ENV plugins_multiDatastream_enable=false
ENV http_cors_enable=true
ENV http_cors_allowed_origins=*
ENV persistence_db_driver=org.postgresql.Driver
ENV persistence_autoUpdateDatabase=true
ENV persistence_idGenerationMode=ServerAndClientGenerated
ENV plugins_coreModel_idType_thing=STRING
ENV plugins_coreModel_idType_location=STRING
ENV plugins_coreModel_idType_datastream=STRING
ENV plugins_coreModel_idType_feature=STRING
ENV mqtt_Enabled=false
ENV persistence.slowQueryThreshold=2300

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions