dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Question][Critical] java.lang.IllegalArgumentException: illegal packet [magic]72

Open wynn45de opened this issue 5 years ago • 18 comments

encountered the same issue, how to fix

version: 1.3.4

[ERROR] 2021-04-07 00:01:14.406 org.apache.dolphinscheduler.remote.handler.NettyClientHandler:[184] - exceptionCaught : {}
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]72
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: illegal packet [magic]72
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:98)
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:53)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
	... 15 common frames omitted
[ERROR] 2021-04-07 00:01:14.407 org.apache.dolphinscheduler.remote.handler.NettyClientHandler:[184] - exceptionCaught : {}
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]84
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421)
	at io.netty.handler.codec.ReplayingDecoder.channelInputClosed(ReplayingDecoder.java:329)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:372)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:355)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:224)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1403)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
	at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:912)
	at io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:826)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:495)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: illegal packet [magic]84
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:98)
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:53)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
	... 16 common frames omitted
[ERROR] 2021-04-07 00:38:45.120 org.apache.dolphinscheduler.remote.handler.NettyServerHandler:[153] - exceptionCaught : java.lang.IllegalArgumentException: illegal packet [magic]72
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]72
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:278)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1408)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:930)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:677)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:612)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:529)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:491)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: illegal packet [magic]72
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:98)
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:53)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
	... 15 common frames omitted
[ERROR] 2021-04-07 00:38:45.121 org.apache.dolphinscheduler.remote.handler.NettyServerHandler:[153] - exceptionCaught : java.lang.IllegalArgumentException: illegal packet [magic]69
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]69
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421)
	at io.netty.handler.codec.ReplayingDecoder.channelInputClosed(ReplayingDecoder.java:329)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:372)
	at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:355)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:224)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1403)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231)
	at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:912)
	at io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:826)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:495)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: illegal packet [magic]69
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:98)
	at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:53)
	at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:502)
	at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
	... 16 common frames omitted

_Originally posted by @wynn45de in https://github.com/apache/incubator-dolphinscheduler/issues/4134

wynn45de avatar Apr 08 '21 00:04 wynn45de

Thanks for your feedback, I need some time to test. btw, please submit the standardized ISSUE according to the ISSUE template

CalvinKirs avatar Apr 09 '21 06:04 CalvinKirs

Thank you for your feedback, any progress ?

wynn45de avatar Apr 12 '21 01:04 wynn45de

@wynn45de I can't reproduce this problem on 1.3.4-release, it is better to provide more information, such as what operation was performed, in which module the exception was reported, thanks.

ruanwenjun avatar Apr 12 '21 05:04 ruanwenjun

deploy mode : docker the exception was found in master logs, when a process was triggered, one task of the process was stuck at status "Submit Success" and keep this status all the time

wynn45de avatar Apr 12 '21 06:04 wynn45de

@wynn45de What type of the task? :grimacing:

ruanwenjun avatar Apr 12 '21 07:04 ruanwenjun

it's not a base task in DS, we do some rebuild and enhancement ,the task is defined by ourself. I don't think the type of task is a key issue

wynn45de avatar Apr 12 '21 07:04 wynn45de

it's not a base task in DS, we do some rebuild and enhancement ,the task is defined by ourself. I don't think the type of task is a key issue

It seems that the task has been submitted to DB success and dispatch to worker failed. Did you modify the protocol ? Each message sent should start with MAGIC, you can check in the NettyEncoder and NettyDecoder. BTY, Did all tasks fail?

ruanwenjun avatar Apr 14 '21 02:04 ruanwenjun

@wynn45de Did you try the latest version 1.3.6 with docker? In 1.3.4 release of docker, there are some problems

chengshiwen avatar Jun 03 '21 09:06 chengshiwen

2021-06-16 20:33:36.095 INFO org.apache.curator.framework.state.ConnectionStateManager:[251] - State change: CONNECTED 2021-06-16 20:33:47.439 ERROR org.apache.dolphinscheduler.remote.handler.NettyServerHandler:[153] - exceptionCaught : java.lang.IllegalArgumentException: illegal packet [magic]71 io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]71 at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalArgumentException: illegal packet [magic]71 at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:118) at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:54) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) ... 14 common frames omitted

lyn916 avatar Jun 16 '21 12:06 lyn916

2021-06-16 20:33:36.095 INFO org.apache.curator.framework.state.ConnectionStateManager:[251] - State change: CONNECTED 2021-06-16 20:33:47.439 ERROR org.apache.dolphinscheduler.remote.handler.NettyServerHandler:[153] - exceptionCaught : java.lang.IllegalArgumentException: illegal packet [magic]71 io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]71 at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IllegalArgumentException: illegal packet [magic]71 at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:118) at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:54) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) ... 14 common frames omitted

1.3.6 version

lyn916 avatar Jun 16 '21 12:06 lyn916

Can you provide steps to reproduce? At present, I can't determine the problem, it seems that the magic numbers are inconsistent. But I can't determine the specific problem.

CalvinKirs avatar Jun 16 '21 13:06 CalvinKirs

I installed 4 workers on 4 machine. I also got this error

[ERROR] 2021-06-26 00:04:10.332 org.apache.dolphinscheduler.remote.handler.NettyServerHandler:[152] - exceptionCaught : java.lang.IllegalArgumentException: illegal packet [magic]-1
io.netty.handler.codec.DecoderException: java.lang.IllegalArgumentException: illegal packet [magic]-1
        at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:421)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
        at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795)
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:475)
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: illegal packet [magic]-1
        at org.apache.dolphinscheduler.remote.codec.NettyDecoder.checkMagic(NettyDecoder.java:125)
        at org.apache.dolphinscheduler.remote.codec.NettyDecoder.decode(NettyDecoder.java:57)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
        at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
        ... 14 common frames omitted

Every worker machine's log has this log.

wordhardqi avatar Jun 25 '21 16:06 wordhardqi

It would be nice to have specific information, at the moment I don't think it's a DS question. The magic number checksum failure indicates that the sender message format does not match. Maybe you should check if another client has tried to send a message to DS.(I'm just stating a possible scenario)

CalvinKirs avatar Jun 25 '21 16:06 CalvinKirs

It is possible that use the other monitoring system , and the health check calls the same port. I just encountered this problem, and fix by changing the health check port .

timlincool avatar Jul 02 '21 12:07 timlincool

no update.

CalvinKirs avatar Jul 04 '21 15:07 CalvinKirs

2024, i still meeted this bug...........

hello-zhihui avatar Jan 09 '24 03:01 hello-zhihui

I just encountered this issue as well and found out that it was caused by a vulnerability scanning tool installed on the cloud server, which periodically scans the 1234 port that the Netty Server is listening on. Therefore, this is not a bug but may be related to your machine and environment. Please check if there are any other applications or tools accessing this port.

fanzhenyu95 avatar May 08 '24 05:05 fanzhenyu95

If the Java Prometheus JMX (exporter) does not specify a port, it will by default scan all available ports—including DolphinScheduler’s Netty default port 1234—which leads to a protocol mismatch and results in “illegal packet [magic]”. Please check whether any similar monitoring services are scanning host ports.

onemax888 avatar Oct 30 '25 09:10 onemax888