mojira.dev
MC-54932

Target selectors with high radius freeze the block update cycle

The bug

When a target selector has a particularly high radius (e.g. @e[distance=..100000000]), it freezes the block update cycle until the command has finished executing, which is often one or two full seconds.
This is especially noticeable if the command block is activated by a clock.

Code analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Comments 12

Your Java version is OUT OF DATE! Please update to the latest version, which can be found here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

I've updated Java; the issue persists.

Confirmed for

  • 1.8.4

  • 1.8.6

  • 1.8.7 also for dx, dy and dz

  • 1.9-pre4

The reason why this happens is that a radius of 100000 means it has to test in ((100000 * 2) / 16)^2 (=156250000) chunks if an entity meets the conditions even though most of these chunks are unloaded.

At some point it is more efficient to go through all entities in the loaded entity list.

Can't reproduce the issue for Player-only selectors (@a,@p,@r without type). Tested only in singleplayer

2 more comments

Confirmed for 18w32a, with the upper limit of distance= in place of r=. Setting only the lower limit has no effect, so

distance=1000000..

will not trigger the bug, but any of

distance=1000000
distance=..1000000

will.

Confirmed for 1.13.1 (I opened another, now duplicate-marked, report, not having found this one).

Confirmed in 1.15.2 and 20w21a.

Reporter, this still happens in 20w27a or not?

For me, this was fixed somewhere around 1.17. Is anyone still experiencing this issue?

ryanwb2

(Unassigned)

Confirmed

Platform

Normal

Commands, Performance

command_block, selector

Minecraft 14w19a, Minecraft 1.8.4, Minecraft 1.8.5, Minecraft 1.8.6, Minecraft 1.8.7, ..., 1.16.1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 21w19a

Retrieved