Skip to content

SslHandler: Fix possible NPE when executor is used for delegating - #14830

Merged
normanmaurer merged 1 commit into
4.1from
ssl_delegate_npe
Feb 18, 2025
Merged

normanmaurer merged 1 commit into
4.1from
ssl_delegate_npe

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

Motivation:

We need to check if pendingUnencryptedWrites is null before accessing it as the SslHandler might have been removed in the meantime.

io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Cannot invoke "io.netty.handler.ssl.SslHandlerCoalescingBufferQueue.isEmpty()" because "this.pendingUnencryptedWrites" is null
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.wrapIfNeeded(SslHandler.java:1798)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.safeExceptionCaught(SslHandler.java:1785)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1896)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.access$2000(SslHandler.java:1751)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner$2.run(SslHandler.java:1912)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:405)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException: Cannot invoke "io.netty.handler.ssl.SslHandlerCoalescingBufferQueue.isEmpty()" because "this.pendingUnencryptedWrites" is null
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1503)
	at io.netty.handler.ssl.SslHandler.unwrapNonAppData(SslHandler.java:1469)
	at io.netty.handler.ssl.SslHandler.access$1800(SslHandler.java:170)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1847)
	... 9 more

Modifications:

Add null check

Result:

Fix NPE

Motivation:

We need to check if pendingUnencryptedWrites is null before accessing it as the SslHandler might have been removed in the meantime.

```
io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Cannot invoke "io.netty.handler.ssl.SslHandlerCoalescingBufferQueue.isEmpty()" because "this.pendingUnencryptedWrites" is null
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.wrapIfNeeded(SslHandler.java:1798)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.safeExceptionCaught(SslHandler.java:1785)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1896)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.access$2000(SslHandler.java:1751)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner$2.run(SslHandler.java:1912)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:405)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException: Cannot invoke "io.netty.handler.ssl.SslHandlerCoalescingBufferQueue.isEmpty()" because "this.pendingUnencryptedWrites" is null
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1503)
	at io.netty.handler.ssl.SslHandler.unwrapNonAppData(SslHandler.java:1469)
	at io.netty.handler.ssl.SslHandler.access$1800(SslHandler.java:170)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1847)
	... 9 more
```

Modifications:

Add null check

Result:

Fix NPE
@normanmaurer

Copy link
Copy Markdown
Member Author

This was introduced by #14411

@normanmaurer normanmaurer added this to the 4.1.119.Final milestone Feb 17, 2025
@normanmaurer
normanmaurer merged commit 0138f23 into 4.1 Feb 18, 2025
@normanmaurer
normanmaurer deleted the ssl_delegate_npe branch February 18, 2025 06:44
normanmaurer added a commit that referenced this pull request Feb 18, 2025
…4830)

Motivation:

We need to check if pendingUnencryptedWrites is null before accessing it
as the SslHandler might have been removed in the meantime.

```
io.netty.handler.codec.DecoderException: java.lang.NullPointerException: Cannot invoke "io.netty.handler.ssl.SslHandlerCoalescingBufferQueue.isEmpty()" because "this.pendingUnencryptedWrites" is null
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.wrapIfNeeded(SslHandler.java:1798)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.safeExceptionCaught(SslHandler.java:1785)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1896)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.access$2000(SslHandler.java:1751)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner$2.run(SslHandler.java:1912)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:405)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:998)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.NullPointerException: Cannot invoke "io.netty.handler.ssl.SslHandlerCoalescingBufferQueue.isEmpty()" because "this.pendingUnencryptedWrites" is null
	at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1503)
	at io.netty.handler.ssl.SslHandler.unwrapNonAppData(SslHandler.java:1469)
	at io.netty.handler.ssl.SslHandler.access$1800(SslHandler.java:170)
	at io.netty.handler.ssl.SslHandler$SslTasksRunner.resumeOnEventExecutor(SslHandler.java:1847)
	... 9 more
```

Modifications:

Add null check

Result:

Fix NPE
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to dongjoon-hyun/spark that referenced this pull request Mar 5, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <[email protected]>
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit e84c345)
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 10, 2026
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Ko-dany pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants