Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Empty class member cause NullpointerException #4770

Closed
3 tasks done
scwlkq opened this issue Feb 15, 2024 · 1 comment · Fixed by #4777
Closed
3 tasks done

[Bug] Empty class member cause NullpointerException #4770

scwlkq opened this issue Feb 15, 2024 · 1 comment · Fixed by #4777
Labels
bug Something isn't working

Comments

@scwlkq
Copy link
Contributor

scwlkq commented Feb 15, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Environment

Mac

EventMesh version

master

What happened

Runtime(Storage:Local Rocketmq ) + Http Source Connector

image
请求的路径应该是:curl发送请求->CloudEvent->ConnectRecord-> runtime(storage)
然后我发现是在CloudEvent->ConnectRecord转化的过程中position属性为null:
image

但是关于消息写入的offset和partition这些属性 应该是由storage的相关模块写入,但是我在CloudEventUtil里看到了关于这个的todo?

How to reproduce

run Runtime(Storage:Local Rocketmq ) + Http Source Connector

Debug logs

2024-02-16 00:11:21,099 DEBUG [vert.x-eventloop-thread-0] ZlibCodecFactory(ZlibCodecFactory.java:39) - -Dio.netty.noJdkZlibDecoder: false
2024-02-16 00:11:21,099 DEBUG [vert.x-eventloop-thread-0] ZlibCodecFactory(ZlibCodecFactory.java:42) - -Dio.netty.noJdkZlibEncoder: false
2024-02-16 00:11:21,170 INFO  [vert.x-eventloop-thread-0] HttpSourceConnector(HttpSourceConnector.java:100) - [HttpSourceConnector] Succeed to convert payload into CloudEvent. StatusCode=200
2024-02-16 00:11:21,174 INFO  [pool-3-thread-1] CloudEventUtil(CloudEventUtil.java:69) - handle receive events testdata



Exception in thread "pool-2-thread-1" java.lang.NullPointerException
	at org.apache.eventmesh.openconnect.offsetmgmt.api.storage.OffsetStorageWriterImpl.writeOffset(OffsetStorageWriterImpl.java:57)
	at java.util.HashMap.forEach(HashMap.java:1290)
	at java.util.Collections$UnmodifiableMap.forEach(Collections.java:1507)
	at org.apache.eventmesh.openconnect.SourceWorker.commitOffsets(SourceWorker.java:346)
	at org.apache.eventmesh.openconnect.SourceWorker.startPollAndSend(SourceWorker.java:219)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@scwlkq scwlkq added the bug Something isn't working label Feb 15, 2024
@xwm1992
Copy link
Contributor

xwm1992 commented Feb 18, 2024

可以修复一下这个bug,对于http source connector不需要对应的offset,可以对空指针做一个兼容。 @scwlkq

mxsm pushed a commit that referenced this issue Feb 20, 2024
* Add null check in writeOffset method

* delete todo

* Move data.put inside null check in writeOffset method

* simplify if judgement

* remove dev environment

* fix style
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants