context.Orion-LD icon indicating copy to clipboard operation
context.Orion-LD copied to clipboard

Request error: socket hang up

Open manfredipist opened this issue 8 months ago • 4 comments

Hello there, while trying to provision the followin payload config_mapping_tool.json Orion get stuck. This is the only useful warning i can retrieve

time=Monday 07 Apr 13:33:35 2025.708Z | lvl=WARN | corr=e812dd68-13b4-11f0-ba80-22b5d6878ea0 | trans=1744032723-319-00000000004 | from=10.89.0.19 | srv=pending | subsrv=<default> | comp=Orion | op=rest.cpp[1623]:connectionTreat | msg=orionldState.in.contentType: None

This is the log from iotagent-aas:

time=2025-04-07T13:32:02.861Z | lvl=DEBUG | corr=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | trans=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | op=IoTAgentNGSI.Request | from=n/a | srv=aas_pioneer | subsrv=/waam | msg=Error: "RequestError: socket hang up\n    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n    at Socket.socketOnEnd (node:_http_client:518:9)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at connResetException (node:internal/errors:705:14)\n    at Socket.socketOnEnd (node:_http_client:518:23)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21) {\n  code: 'ECONNRESET',\n  timings: {\n    start: 1744032717630,\n    socket: 1744032717630,\n    lookup: 1744032722484,\n    connect: 1744032722509,\n    secureConnect: undefined,\n    upload: 1744032722509,\n    response: undefined,\n    end: undefined,\n    error: 1744032722861,\n    abort: undefined,\n    phases: {\n      wait: 0,\n      dns: 4854,\n      tcp: 25,\n      tls: undefined,\n      request: 0,\n      firstByte: undefined,\n      download: undefined,\n      total: 5231\n    }\n  }\n}" | comp=IoTAgent
time=2025-04-07T13:32:02.862Z | lvl=ERROR | corr=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | trans=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | op=IoTAgentNGSI.Registration | from=n/a | srv=aas_pioneer | subsrv=/waam | msg=ORION-002: Connection error sending registrations to the Context Broker: RequestError: socket hang up
    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at ClientRequest.emit (node:domain:489:12)
    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at Socket.socketOnEnd (node:_http_client:518:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at connResetException (node:internal/errors:705:14)
    at Socket.socketOnEnd (node:_http_client:518:23)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET',
  timings: [Object]
} | comp=IoTAgent
time=2025-04-07T13:32:02.863Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Error: "RequestError: socket hang up\n    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n    at Socket.socketOnEnd (node:_http_client:518:9)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at connResetException (node:internal/errors:705:14)\n    at Socket.socketOnEnd (node:_http_client:518:23)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21) {\n  code: 'ECONNRESET',\n  timings: {\n    start: 1744032717609,\n    socket: 1744032717609,\n    lookup: 1744032722484,\n    connect: 1744032722508,\n    secureConnect: undefined,\n    upload: 1744032722508,\n    response: undefined,\n    end: undefined,\n    error: 1744032722862,\n    abort: undefined,\n    phases: {\n      wait: 0,\n      dns: 4875,\n      tcp: 24,\n      tls: undefined,\n      request: 0,\n      firstByte: undefined,\n      download: undefined,\n      total: 5253\n    }\n  }\n}" | comp=IoTAgent
time=2025-04-07T13:32:02.863Z | lvl=ERROR | corr=n/a | trans=n/a | op=IoTAgentNGSI.Registration | from=n/a | srv=n/a | subsrv=n/a | msg=ORION-002: Connection error sending registrations to the Context Broker: RequestError: socket hang up
    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at ClientRequest.emit (node:domain:489:12)
    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at Socket.socketOnEnd (node:_http_client:518:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at connResetException (node:internal/errors:705:14)
    at Socket.socketOnEnd (node:_http_client:518:23)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET',
  timings: [Object]
} | comp=IoTAgent
time=2025-04-07T13:32:02.864Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Error: "RequestError: socket hang up\n    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n    at Socket.socketOnEnd (node:_http_client:518:9)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at connResetException (node:internal/errors:705:14)\n    at Socket.socketOnEnd (node:_http_client:518:23)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21) {\n  code: 'ECONNRESET',\n  timings: {\n    start: 1744032717596,\n    socket: 1744032717597,\n    lookup: 1744032722479,\n    connect: 1744032722496,\n    secureConnect: undefined,\n    upload: 1744032722497,\n    response: undefined,\n    end: undefined,\n    error: 1744032722863,\n    abort: undefined,\n    phases: {\n      wait: 1,\n      dns: 4882,\n      tcp: 17,\n      tls: undefined,\n      request: 1,\n      firstByte: undefined,\n      download: undefined,\n      total: 5267\n    }\n  }\n}" | comp=IoTAgent
time=2025-04-07T13:32:02.864Z | lvl=ERROR | corr=n/a | trans=n/a | op=IoTAgentNGSI.Registration | from=n/a | srv=n/a | subsrv=n/a | msg=ORION-002: Connection error sending registrations to the Context Broker: RequestError: socket hang up
    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at ClientRequest.emit (node:domain:489:12)
    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at Socket.socketOnEnd (node:_http_client:518:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at connResetException (node:internal/errors:705:14)
    at Socket.socketOnEnd (node:_http_client:518:23)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET',
  timings: [Object]
} | comp=IoTAgent
time=2025-04-07T13:32:02.865Z | lvl=DEBUG | corr=n/a | trans=n/a | op=IoTAgentNGSI.Request | from=n/a | srv=n/a | subsrv=n/a | msg=Error: "RequestError: socket hang up\n    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n    at Socket.socketOnEnd (node:_http_client:518:9)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at connResetException (node:internal/errors:705:14)\n    at Socket.socketOnEnd (node:_http_client:518:23)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21) {\n  code: 'ECONNRESET',\n  timings: {\n    start: 1744032717612,\n    socket: 1744032717612,\n    lookup: 1744032722484,\n    connect: 1744032722508,\n    secureConnect: undefined,\n    upload: 1744032722508,\n    response: undefined,\n    end: undefined,\n    error: 1744032722865,\n    abort: undefined,\n    phases: {\n      wait: 0,\n      dns: 4872,\n      tcp: 24,\n      tls: undefined,\n      request: 0,\n      firstByte: undefined,\n      download: undefined,\n      total: 5253\n    }\n  }\n}" | comp=IoTAgent
time=2025-04-07T13:32:02.866Z | lvl=ERROR | corr=n/a | trans=n/a | op=IoTAgentNGSI.Registration | from=n/a | srv=n/a | subsrv=n/a | msg=ORION-002: Connection error sending registrations to the Context Broker: RequestError: socket hang up
    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at ClientRequest.emit (node:domain:489:12)
    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at Socket.socketOnEnd (node:_http_client:518:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at connResetException (node:internal/errors:705:14)
    at Socket.socketOnEnd (node:_http_client:518:23)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET',
  timings: [Object]
} | comp=IoTAgent
time=2025-04-07T13:32:02.867Z | lvl=DEBUG | corr=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | trans=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | op=IoTAgentNGSI.Request | from=n/a | srv=aas_pioneer | subsrv=/waam | msg=Error: "RequestError: socket hang up\n    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)\n    at Object.onceWrapper (node:events:628:26)\n    at ClientRequest.emit (node:events:525:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n    at Socket.socketOnEnd (node:_http_client:518:9)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at connResetException (node:internal/errors:705:14)\n    at Socket.socketOnEnd (node:_http_client:518:23)\n    at Socket.emit (node:events:525:35)\n    at Socket.emit (node:domain:552:15)\n    at endReadableNT (node:internal/streams/readable:1358:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21) {\n  code: 'ECONNRESET',\n  timings: {\n    start: 1744032717607,\n    socket: 1744032717607,\n    lookup: 1744032722484,\n    connect: 1744032722507,\n    secureConnect: undefined,\n    upload: 1744032722508,\n    response: undefined,\n    end: undefined,\n    error: 1744032722866,\n    abort: undefined,\n    phases: {\n      wait: 0,\n      dns: 4877,\n      tcp: 23,\n      tls: undefined,\n      request: 1,\n      firstByte: undefined,\n      download: undefined,\n      total: 5259\n    }\n  }\n}" | comp=IoTAgent
time=2025-04-07T13:32:02.867Z | lvl=ERROR | corr=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | trans=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | op=IoTAgentNGSI.Registration | from=n/a | srv=aas_pioneer | subsrv=/waam | msg=ORION-002: Connection error sending registrations to the Context Broker: RequestError: socket hang up
    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/got/dist/source/core/index.js:970:111)
    at Object.onceWrapper (node:events:628:26)
    at ClientRequest.emit (node:events:525:35)
    at ClientRequest.emit (node:domain:489:12)
    at ClientRequest.origin.emit (/opt/iotagent-aas/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
    at Socket.socketOnEnd (node:_http_client:518:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at connResetException (node:internal/errors:705:14)
    at Socket.socketOnEnd (node:_http_client:518:23)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'ECONNRESET',
  timings: [Object]
} | comp=IoTAgent
time=2025-04-07T13:32:02.867Z | lvl=ERROR | corr=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | trans=d50ee5a1-30a0-4126-8e8c-abc6b1fcd790 | op=IoTAgentNGSI.DomainControl | from=n/a | srv=aas_pioneer | subsrv=/waam | msg=FetchError: request to http://orion:1026/v2/entities failed, reason: socket hang up
    at ClientRequest.<anonymous> (/opt/iotagent-aas/node_modules/node-fetch/lib/index.js:1501:11)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at Socket.socketOnEnd (node:_http_client:518:9)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ECONNRESET',
  code: 'ECONNRESET'
} | comp=IoTAgent

This only happen when configuring orion to store metrics into timescale otherwise everything proceed smoothly. Attached my docker-compose file:

services:
  iot-agent:
    image: iotagent4fiware/iotagent-aas:latest
    hostname: iotagent-aas
    depends_on:
      - mongodb
      - orion
    networks:
      - hostnet
    ports:
      - "4041:4041"
      - "7896:7896"
    env_file:
      - CONFIGURATION_TYPE=auto
      - DEFAULT_KEY=iot
      - DEFAULT_TRANSPORT=HTTP
      - IOTA_EXPRESS_LIMIT=256mb
      - IOTA_LOGLEVEL=DEBUG
      - IOTA_TIMESTAMP=true
      - IOTA_CB_HOST=orion
      - IOTA_CB_PORT=1026
      - IOTA_CB_NGSIVERSION=ld
      - IOTA_CB_SERVICE=aas_pioneer
      - IOTA_CB_SUBSERVICE=/smc 
      - IOTA_NORTH_PORT=4041
      - IOTA_REGISTRY_TYPE=mongodb
      - IOTA_MONGO_HOST=mongodb
      - IOTA_MONGO_PORT=27017
      - IOTA_MONGO_DB=iotagent_aas
      - IOTA_SERVICE=aas_pioneer
      - IOTA_SUBSERVICE=/waam
      - IOTA_PROVIDER_URL=http://iotagent-aas:4041
      - IOTA_DEVICEREGDURATION=P20Y
      - IOTA_DEFAULTTYPE=Machine
      - IOTA_DEFAULTRESOURCE=/iot/aas
      - IOTA_EXPLICITATTRS=true
      - IOTA_AUTOPROVISION=true
      - IOTA_HTTP_PORT=7897
      - IOTA_HTTP_TIMEOUT=1000
      - IOTA_AAS_ENDPOINT=http://my-url/aas
      - IOTA_AAS_API_VERSION=v1
      - IOTA_AAS_MT_AGENT_ID=age01_
      - IOTA_AAS_MT_ENTITY_ID=SmcMachine
      - IOTA_AAS_MT_ENTITY_TYPE=Machine
      - IOTA_AAS_MT_STORE_OUTPUT=true
      - IOTA_AAS_MT_ATTR_SEPARATOR_CHARACTER=__
       

  mongodb:
    image: mongo:4.4 #latest
    hostname: mongodb
    networks:
      - hostnet
    ports:
      - "27017:27017"
    command: --bind_ip_all 
    volumes:
      - mongodb:/data

  orion:
    image: fiware/orion-ld:1.9.0
    hostname: orion
    privileged: true
    ipc: host
    depends_on:
      - mongodb
    networks:
      - hostnet
    ports:
      - "1026:1026"
    restart: always
    command: -dbhost mongodb -logLevel DEBUG -mongocOnly l
    environment:
      - ORIONLD_TROE=TRUE
      - ORIONLD_TROE_HOST=timescale
      - ORIONLD_TROE_PORT=5432
      - ORIONLD_TROE_USER=orion
      - ORIONLD_TROE_PWD=orion
      - ORIONLD_MONGO_HOST=mongodb
    healthcheck:
      test: curl --fail -s http://orion:1026/version || exit 1
      interval: 30s
      retries: 15

  timescale:
    image: timescale/timescaledb-ha:pg17-ts2.18
    hostname: timescale
    networks:
      - hostnet
    ports:
      - "5432:5432"  
    environment:
      - POSTGRES_USER=orion
      - POSTGRES_PASSWORD=orion
      - POSTGRES_HOST_AUTH_METHOD=trust
    command: ["postgres", "-c", "log_statement=all"]
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U orion" ]
      interval: 15s
      timeout: 15s
      retries: 5
      start_period: 60s

volumes:
  mongodb: ~

networks:
  hostnet:
    driver: bridge

manfredipist avatar Apr 07 '25 13:04 manfredipist

I need some more info. Looking at the data in "config_mapping_tool.json", it is not clear what API endpoint has been invoked to provoke the error. It seems like a single attribute in Simplified mode ... So, please, post also the command sent to the broker with the data in that file as payload body.

kzangeli avatar Apr 07 '25 15:04 kzangeli

It's the iotagentnode-lib itself that forwards the payload to orion so i'm not sure wht api is calling but this is a more extensive long if it can help

manfredipist avatar Apr 08 '25 15:04 manfredipist

ok, then let's do something different to get more info. Please start the broker with all traces ON: -t 0-255 and post the brokers logfile to the issue. That should help.

kzangeli avatar Apr 08 '25 15:04 kzangeli