Search code examples
fiware

FIWARE IoT Agent-UL freezes up when delete a device that does not exists


I have problems when I try to remove a FIWARE IoT Agent UL device using the REST API.

If I try to delete a device that exists, the service returns an HTTP code 204 and everything works as expected.

However, if I try to delete a device that does NOT exist, the service "hangs up" and I do not get any response from it.

This is the output of the node app, related to the service request that I made:

time=2018-03-22T14:30:39.225Z | lvl=DEBUG | corr=9dff81b8-2cbe-4236-9bdc-  82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.GenericMiddlewares | srv=foo | subsrv=/bar | msg=Request for path [/iot/devices/641tvjjr] from [localhost:4061] | comp=IoTAgent
time=2018-03-22T14:30:39.226Z | lvl=DEBUG | corr=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.DeviceService | srv=foo | subsrv=/bar | msg=Removing device register in Device Service | comp=IoTAgent
time=2018-03-22T14:30:39.226Z | lvl=DEBUG | corr=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=foo | subsrv=/bar | msg=Looking for entity with id [641tvjjr]. | comp=IoTAgent
time=2018-03-22T14:30:39.228Z | lvl=DEBUG | corr=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.MongoDBDeviceRegister | srv=foo | subsrv=/bar | msg=Entity [641tvjjr] not found. | comp=IoTAgent
time=2018-03-22T14:30:39.229Z | lvl=ERROR | corr=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.Alarms | srv=foo | subsrv=/bar | msg=Raising [MONGO-ALARM]: undefined | comp=IoTAgent
time=2018-03-22T14:30:39.230Z | lvl=ERROR | corr=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.DomainControl | srv=foo | subsrv=/bar | msg=TypeError: Cannot read property 'service' of undefined | comp=IoTAgent
time=2018-03-22T14:30:39.230Z | lvl=DEBUG | corr=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | trans=9dff81b8-2cbe-4236-9bdc-82b912df1ff0 | op=IoTAgentNGSI.DomainControl | srv=foo | subsrv=/bar | msg=response-time: 5 | comp=IoTAgent

I'm working with a single service, with values of Fiware-Service: "foo" and Fiware-ServicePath: "/bar", devices in that service and the default agent configuration file. Also, I am using the 1.6.0 release of IoT Agent UL, which by the way is the latest version.

Everything else works correctly, device creation, devices listing, send measurements, etc. Everything except the elimination of a device that does not exist.

Has this happened to someone? It seems very strange to me and I can not believe that it is the first person that tries to erase a device that does not exist.

Thank you in advance


Solution

  • For all those who share the same question as me:

    Apparently it's an open issue in node lib project.

    the api should return a 404, but it seems that an exception is not capture somewhere and because of that infinite response time is caused.

    Fortunately there is a pull request of the same guy who report the issue which fix it. In conclusion may be in next release it the problem will be resolved.