Skip to content

MUC room created_at timestamp incorrectly set to 1970-01-02 #4465

@YonesSohrabi

Description

@YonesSohrabi

Description

When creating a new MUC room via API or any other method, the created_at field in the muc_room database table is set to 1970-01-02 00:00:00 instead of the actual creation time.

Steps to Reproduce

  1. Create a new MUC room:
curl -X POST http://localhost:5285/api/create_room_with_opts \
  -H "Content-Type: application/json" \
  -d '{
    "room": "testroom",
    "service": "conference.localhost",
    "host": "localhost",
    "options": [{"name": "persistent", "value": "true"}]
  }'
  1. Check database:
SELECT name, created_at FROM muc_room WHERE name='testroom';
  1. Result: created_at = 1970-01-02 00:00:00

Expected Behavior

created_at should be set to the current timestamp.

Root Cause

In src/mod_muc_sql.erl, the code uses hibernation_time to set created_at. When a room is first created, hibernation_time is not set, defaulting to 1970-01-02 00:00:00.

Environment

  • ejabberd: 25.03 (affects all versions)
  • Database: MySQL/PostgreSQL/SQLite
  • OS: Linux

Proposed Solution

I have a PR ready that:

  1. Adds updated_at column to track modifications
  2. Ensures created_at is set correctly and never changes
  3. Separates created_at, updated_at, and hibernation_time concerns

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions