SQL errors on .139 update for Owntracks

C8 2.3.8.139
I had these errors on .128 and they disappeared on .129 but now they are back on .139.
Is this a DB isssue or Owntracks sending a malformed Delete request?
Only happens once or twice a day. Different times on 2 devices but the same app.
Some seem to indicate it might be an HE SQL issue.

dev:21422024-04-15 06:08:07.539errorjava.lang.RuntimeException: java.sql.SQLException: Referential integrity constraint violation: "FK_DCDS_TO_DEVICESTATE: PUBLIC.DEVICE_CURRENT_DEVICE_STATE FOREIGN KEY(DEVICE_STATE_ID) REFERENCES PUBLIC.DEVICE_STATE(ID) (CAST(25995599 AS BIGINT))"; SQL statement: DELETE FROM device_state WHERE device_id = ? AND attribute_name = ? [23503-224] Query: DELETE FROM device_state WHERE device_id = ? AND attribute_name = ? Parameters: [2142, battery] on line 253 (method generatePresenceEvent)

dev:21382024-04-15 01:52:37.221errorjava.lang.RuntimeException: java.sql.SQLException: Referential integrity constraint violation: "FK_DCDS_TO_DEVICESTATE: PUBLIC.DEVICE_CURRENT_DEVICE_STATE FOREIGN KEY(DEVICE_STATE_ID) REFERENCES PUBLIC.DEVICE_STATE(ID) (CAST(25993608 AS BIGINT))"; SQL statement: DELETE FROM device_state WHERE device_id = ? AND attribute_name = ? [23503-224] Query: DELETE FROM device_state WHERE device_id = ? AND attribute_name = ? Parameters: [2138, since] on line 252 (method generatePresenceEvent)

Any sql error is hub related not caused by apps or drivers since they don’t direct access to the database. They use an API. I recommend you perform a soft reset. Download a backup and restore it.

2 Likes

You can also just do a reboot > check advanced > check rebuild database.
This does the same thing and is much easier (and less scary) to do.

Good suggestion though last time I tried it on my hubs it didn’t work. I’ve seen other reports of same issue in the community as well. Will admit I haven’t tried it in a while though.

True, there is no way to know for sure if it worked or not.
Another option is also to just download a backup and then restore it right away. This also does a soft reset as part of the restore process. The soft reset method is the only way where you can 100% confirm the database was cleared though, because when you reboot it will give you the welcome screens.

I'll give a Soft reset a try. Not a big deal just strange one app throws that error sometimes.

Full agree with this being a hub specific issue, for context, the area that is causing this is doing a bunch of device.deleteCurrentState('xxx') type calls in sequence to remove states (about 20 different states). In previous testing, HE handles this without issue.

Thoughts on that?

Yes, I think it's SQL. I used to use SQL in my "old" programmer days.
Just strange it's only OT that pulls the errors.

1 Like

@bobbyD is what I'm doing "bad practice" for HE? Fully appreciating that "'cause it used to work (while doing something wrong)'" could also be the issue! :slight_smile:

See my private message.

@lpakula
Don't know what triggered this on 1.7.5.2 but I'm getting hundreds of these, one every few seconds.
My wife has been out of town for 4 days , no cell on a boat, so no reply to OT queries.
This just started happening - too many events.
I have unticked her in Family members to monitor.

dev:21382024-05-01 17:51:59.858errorcom.hubitat.app.exception.LimitExceededException: Too many events pending processing for device 2138 on line 478 (method generatePresenceEvent)

dev:21382024-05-01 17:51:58.979errorcom.hubitat.app.exception.LimitExceededException: Too many events pending processing for device 2138 on line 478 (method generatePresenceEvent)

Is she under the "private member" box as well?

No private member.
I'm getting this now every 0.5 hours

app:16332024-05-02 09:23:28.420warnOwnTracks: User: 'RozOT' not enabled. To enable this member, open the Hubitat OwnTracks app, select 'RozOT' in 'Select family member(s) to monitor' box and then click 'Done'.

Just noticed I was reporting this under the wrong thread!

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.