Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Offical apps | Community apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. Bug report: Possible uncaught error in box/src/eventlog.js (v9.1.6)

Bug report: Possible uncaught error in box/src/eventlog.js (v9.1.6)

Scheduled Pinned Locked Moved Solved Support
eventlogcrash
2 Posts 2 Posters 95 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davejgreen
    wrote last edited by girish
    #1

    Our Cloudron event log unexpectedly showed "30 Jul 2026, 01:00 boot Cloudron started with version 9.1.6" this morning, which appears to have made our overnight backup fail, so I was looking into what happened. We are on British Summer Time, so this actually happened at 00:00 UTC.

    The /home/yellowtent/platfromdata/logs/box.log shows the following at this time:

    2026-07-29T23:59:53.169Z apphealthmonitor: app health: 17 running / 4 stopped / 1 unresponsive
    2026-07-30T00:00:00.005Z janitor: Cleaning up docker volumes
    2026-07-30T00:00:00.009Z janitor: Cleaning up expired tokens
    2026-07-30T00:00:00.011Z eventlog: cleanup: pruning events. creationTime: Fri May 01 2026 00:00:00 GMT+0000 (Coordinated Universal Time)
    2026-07-30T00:00:00.017Z janitor: Cleaned up 0 expired tokens
    2026-07-30T00:00:00.322Z From uncaughtException handler.
    2026-07-30T00:00:00.322Z TypeError: Cannot read properties of undefined (reading 'id')
    2026-07-30T00:00:00.322Z     at Object.upsertLoginEvent (file:///home/yellowtent/box/src/eventlog.js:57:58)
    2026-07-30T00:00:00.322Z     at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    2026-07-30T00:00:24.846Z server: ==========================================
    2026-07-30T00:00:24.856Z tasks: stopAllTasks: 0 tasks are running. sending abort signal
    2026-07-30T00:00:24.858Z shell: tasks: /usr/bin/sudo --non-interactive /home/yellowtent/box/src/scripts/stoptask.sh all
    2026-07-30T00:00:24.850Z server:            Cloudron 9.1.6  
    

    I believe this is the code line in eventlog.js where .id was put on something that was undefined?:

    async function upsertLoginEvent(action, source, data) {
        assert.strictEqual(typeof action, 'string');
        assert.strictEqual(typeof source, 'object'); // an AuditSource
        assert.strictEqual(typeof data, 'object');
    
        // can't do a real sql upsert, for frequent eventlog entries we only have to do 2 queries once a day
        const queries = [{
            query: 'UPDATE eventlog SET creationTime=NOW(), dataJson=? WHERE action = ? AND sourceJson LIKE ? AND DATE(creationTime)=CURDATE()',
            args: [ JSON.stringify(data), action, JSON.stringify(source) ]
        }, {
            query: 'SELECT ' + EVENTLOG_FIELDS + ' FROM eventlog WHERE action = ? AND sourceJson LIKE ? AND DATE(creationTime)=CURDATE()',
            args: [ action, JSON.stringify(source) ]
        }];
    
        const result = await database.transaction(queries);
        if (result[0].affectedRows >= 1) return result[1][0].id; // <--- JUST HERE!
    
        // no existing eventlog found, create one
        return await add(action, source, data);
    }
    

    ChatGPT is telling me that the code is operating on the eventlog table at the exact moment the cleanup job is pruning that same table, but you might have more idea what is actually happening?

    The event log showed a user logged into their mailbox at 00:59 (or 23:59 UTC) just before this happened, but don't know if that is related or not. In any case, I hope that is helpful in catching a possible error.
    Best wishes,
    Dave.

    1 Reply Last reply
    3
    • girishG Offline
      girishG Offline
      girish
      Staff
      wrote last edited by
      #2

      @davejgreen thanks for the report, I have fixed it. The issue was that CURDATE is used in two separate queries but the code assumed it's the same value in both queries. Thus the first query can return something values for CURDATE, but the second one may not since CURDATE has changed.

      1 Reply Last reply
      0
      • girishG girish has marked this topic as solved
      • girishG girish marked this topic as a regular topic
      • J joseph marked this topic as a question
      • J joseph has marked this topic as solved

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Bookmarks
      • Search