Skip to content

Deleting variables with long numeric-only list indices causes severe lag spikes #8733

Description

@REIKO-KR

Skript/Server Version

Server Version: 1.21.11-168-ea288d3 (MC: 1.21.11)
Skript Version: 2.15.3 (skriptlang-github)
Installed Skript Addons:
 - skript-placeholders v1.7.1 (https://github.com/APickledWalrus/skript-placeholders)
 - DiSky v4.29.0
 - skript-reflect v2.6.3 (https://github.com/SkriptLang/skript-reflect)
 - skript-db v1.5.0
 - SkBee v3.18.3 (https://github.com/ShaneBeee/SkBee)
 - SkRedis v2.3.2
Installed dependencies:
 - Vault v1.7.3-b131
 - WorldGuard v7.0.17+2370-e42d8bc

Bug Description

Deleting a variable whose list index is a long numeric-only value can cause a noticeable server lag spike.

I noticed this while using long numeric IDs as list variable indices, such as Discord snowflake IDs or timestamp-like IDs. Creating or setting the variable is fine, but deleting it causes the server to freeze briefly.

Example problematic index:

853420195002187776

When the same value is prefixed with a non-numeric character, such as:

id_853420195002187776

the lag spike does not happen.

Expected Behavior

Deleting a variable should not cause a large lag spike depending on whether the list index is numeric-only.

These two cases should have similar performance:

delete {test::853420195002187776}
delete {test::id_853420195002187776}

Steps to Reproduce

  1. Load this test script:
command /testnumericdelete:
	trigger:
		set {_id} to "853420195002187776"
		set {delete-test::%{_id}%} to "test"

		set {_start} to unix timestamp of now
		send "Before numeric-only delete"
		delete {delete-test::%{_id}%}
		set {_elapsed} to (unix timestamp of now) - {_start}

		send "After numeric-only delete"
		send "numeric-only delete elapsed: %{_elapsed}% seconds"

command /testprefixeddelete:
	trigger:
		set {_id} to "id_853420195002187776"
		set {delete-test::%{_id}%} to "test"

		set {_start} to unix timestamp of now
		send "Before prefixed delete"
		delete {delete-test::%{_id}%}
		set {_elapsed} to (unix timestamp of now) - {_start}

		send "After prefixed delete"
		send "prefixed delete elapsed: %{_elapsed}% seconds"
  1. Run /testnumericdelete.
  2. Check the elapsed time message and whether the server briefly freezes.
  3. Run /testprefixeddelete.
  4. Compare the elapsed time and server behavior.

In my production script, changing mailbox IDs from numeric-only timestamp keys to prefixed keys fixed the lag immediately:

# Lagged when deleting
{mailbox::%uuid%::1780000000000000000}

# No lag when deleting
{mailbox::%uuid%::m_1780000000000000000}

Errors or Screenshots

Image

Other

No response

Agreement

  • I have read the guidelines above and affirm I am following them with this report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue that needs to be fixed. Alternatively, a PR fixing an issue.needs triageAn issue that hasn't been classified or verified yet

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions