louislam/uptime-kuma

Receiving a trace error: `insert into 'stat_hourly' - Duplicate entry '43-1731949200' for key 'stat_hourly_monitor_id_timestamp_unique'`

Open

#5,357 opened on Nov 18, 2024

View on GitHub
 (37 comments) (9 reactions) (1 assignee)JavaScript (7,844 forks)batch import
bughelp wanted

Repository metrics

Stars
 (86,760 stars)
PR merge metrics
 (Avg merge 4d 10h) (27 merged PRs in 30d)

Description

⚠️ Please verify that this question has NOT been raised before.

  • I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

I'm seeing a trace error of duplicate entry for a given monitor stat. I'm not sure why, but I can provide the logs.

📝 Error Message(s) or Log


Trace: Error: insert into `stat_hourly` (`down`, `monitor_id`, `ping`, `ping_max`, `ping_min`, `timestamp`, `up`) values (0, 43, 94.4, 102, 87, 1731949200, 5) - Duplicate entry '43-1731949200' for key 'stat_hourly_monitor_id_timestamp_unique'
    at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:738:17)
    at Query.execute (/app/node_modules/mysql2/lib/commands/command.js:29:26)
    at Connection.handlePacket (/app/node_modules/mysql2/lib/connection.js:481:34)
    at PacketParser.onPacket (/app/node_modules/mysql2/lib/connection.js:97:12)
    at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/app/node_modules/mysql2/lib/connection.js:104:25)
    at Socket.emit (node:events:519:28)
    at addChunk (node:internal/streams/readable:559:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
    at Readable.push (node:internal/streams/readable:390:5) {
  code: 'ER_DUP_ENTRY',
  errno: 1062,
  sqlState: '23000',
  sqlMessage: "Duplicate entry '43-1731949200' for key 'stat_hourly_monitor_id_timestamp_unique'",
  sql: 'insert into `stat_hourly` (`down`, `monitor_id`, `ping`, `ping_max`, `ping_min`, `timestamp`, `up`) values (0, 43, 94.4, 102, 87, 1731949200, 5)'
}
    at Timeout.safeBeat [as _onTimeout] (/app/server/model/monitor.js:1012:25)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-11-18T09:59:16-08:00 [MONITOR] ERROR: Please report to https://github.com/louislam/uptime-kuma/issues
2024-11-18T09:59:16-08:00 [MONITOR] INFO: Try to restart the monitor

🐻 Uptime-Kuma Version

2.0.0-beta.0

💻 Operating System and Arch

TrueNAS Scale Electric Eel 24.10.0

🌐 Browser

N/A

🖥️ Deployment Environment

  • Runtime: Docker 27.1.1
  • Database: External MariaDB
  • Filesystem used to store the database on: ZFS on nvme
  • number of monitors: 16

Contributor guide