Skip to content

japanizeLine1Formatに「%msg」が含まれていると、処理の途中で無限ループが発生する可能性 #201

Closed

Description

@ucchyocean

Describe the bug/バグの概要
japanizeLine1Formatに「%msg」が含まれていると、処理の途中で無限ループが発生する可能性がある

Server and version/サーバーとバージョン

  • Server: Paper 1.16.1 (build 117)
  • LunaChat version : 3.0.10

To Reproduce/再現手順

  1. LunaChat 3.0.10 を導入し、サーバーを起動する。
  2. config.ymlを、次のように設定する。
    japanizeType: GoogleIME
    japanizeDisplayLine: 1
    japanizeLine1Format: '&f%japanize&7 #%msg'
  3. 何か発言を行う
  4. その後、サーバーの停止を行う。サーバー停止時に、実行スレッドが残ったままになっている旨のメッセージが出力される。
    下記は一例)
[01:29:55] [Server thread/ERROR]: Nag author: 'ucchy' of 'LunaChat' about the following: This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies.
[01:29:55] [Server thread/ERROR]: Nag author: 'ucchy' of 'LunaChat' about the following: This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies.
[01:29:55] [Server thread/ERROR]: Nag author: 'ucchy' of 'LunaChat' about the following: This plugin is not properly shutting down its async tasks when it is being shut down. This task may throw errors during the final shutdown logs and might not complete before process dies.
.....

Expected behavior/期待する結果
実行スレッドが残ったままにならないようにすべき

Activity

  1. self-assigned this
    on Aug 16, 2020
  2. ucchyocean commented on Aug 16, 2020

    @ucchyocean
    OwnerAuthor

    また、報告されたPaperのWatchDogログには、下記のように記録されている。

    [09:47:01] [Paper Watchdog Thread/ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Paper-134 (MC: 1.16.1) ---
    [09:47:01] [Paper Watchdog Thread/ERROR]: The server has not responded for 10 seconds! Creating thread dump
    [09:47:01] [Paper Watchdog Thread/ERROR]: ------------------------------
    [09:47:01] [Paper Watchdog Thread/ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
    [09:47:01] [Paper Watchdog Thread/ERROR]: ------------------------------
    [09:47:01] [Paper Watchdog Thread/ERROR]: Current Thread: Server thread
    [09:47:01] [Paper Watchdog Thread/ERROR]: 	PID: 42 | Suspended: false | Native: false | State: RUNNABLE
    [09:47:01] [Paper Watchdog Thread/ERROR]: 	Stack:
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.String.indexOf(String.java:1769)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.String.indexOf(String.java:1735)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.AbstractStringBuilder.indexOf(AbstractStringBuilder.java:1348)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.StringBuilder.indexOf(StringBuilder.java:385)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.AbstractStringBuilder.indexOf(AbstractStringBuilder.java:1329)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.StringBuilder.indexOf(StringBuilder.java:380)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.util.KeywordReplacer.replace(KeywordReplacer.java:33)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.util.ClickableFormat.replace(ClickableFormat.java:252)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.channel.BukkitChannel.sendMessage(BukkitChannel.java:177)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.channel.Channel.chat(Channel.java:323)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.command.LunaChatMessageCommand.sendTellMessage(LunaChatMessageCommand.java:98)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.command.LunaChatReplyCommand.execute(LunaChatReplyCommand.java:56)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		com.github.ucchyocean.lc3.LunaChatBukkit.onCommand(LunaChatBukkit.java:170)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		org.bukkit.command.PluginCommand.execute(PluginCommand.java:45)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		org.bukkit.craftbukkit.v1_16_R1.CraftServer.dispatchCommand(CraftServer.java:794)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.PlayerConnection.handleCommand(PlayerConnection.java:1910)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.PlayerConnection.a(PlayerConnection.java:1721)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.PacketPlayInChat.a(PacketPlayInChat.java:47)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.PacketPlayInChat.a(PacketPlayInChat.java:5)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.PlayerConnectionUtils$$Lambda$6515/597480162.run(Unknown Source)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.TickTask.run(SourceFile:18)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.MinecraftServer.aZ(MinecraftServer.java:1137)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.MinecraftServer.executeNext(MinecraftServer.java:1130)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.MinecraftServer.sleepForTick(MinecraftServer.java:1091)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.MinecraftServer.v(MinecraftServer.java:1005)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.MinecraftServer.lambda$a$0(MinecraftServer.java:177)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		net.minecraft.server.v1_16_R1.MinecraftServer$$Lambda$3000/901953713.run(Unknown Source)
    [09:47:01] [Paper Watchdog Thread/ERROR]: 		java.lang.Thread.run(Thread.java:748)
    [09:47:01] [Paper Watchdog Thread/ERROR]: ------------------------------
    [09:47:01] [Paper Watchdog Thread/ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---
    [09:47:01] [Paper Watchdog Thread/ERROR]: ------------------------------
    
  3. ucchyocean commented on Aug 16, 2020

    @ucchyocean
    OwnerAuthor

    japanizeLine1Formatの4文字目以降に「%msg」

    を試してみたが、再現せず。。。

    上記のWatchDogログによると、KeywordReplacer.replace(KeywordReplacer.java:33) の箇所で無限ループしているようなので、せめてこの箇所に対して何らかの対策は必要。

  4. changed the title [-]japanizeLine1Formatの4文字目以降に「%msg」が含まれていると、処理の途中で無限ループが発生する[/-] [+]japanizeLine1Formatに「%msg」が含まれていると、処理の途中で無限ループが発生する可能性[/+] on Aug 16, 2020
  5. ucchyocean commented on Aug 22, 2020

    @ucchyocean
    OwnerAuthor

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions