Skip to content

[Issue:5669] Fix the ledgerID not found cause NPE - #5809

Merged
wolfstudy merged 4 commits into
apache:masterfrom
wolfstudy:xiaolong/legers_NPE
Dec 23, 2019
Merged

[Issue:5669] Fix the ledgerID not found cause NPE#5809
wolfstudy merged 4 commits into
apache:masterfrom
wolfstudy:xiaolong/legers_NPE

Conversation

@wolfstudy

Copy link
Copy Markdown
Member

Signed-off-by: xiaolong.ran rxl@apache.org

Fixes #5669

Motivation

when ledgers.ceilingKey return a NULL value, we need to process the ledgerId is NUll case.

Modifications

  • change long ledgerId to Long ledgerId and check if ledgerId is NULL.

Signed-off-by: xiaolong.ran <rxl@apache.org>
@wolfstudy wolfstudy self-assigned this Dec 6, 2019
@jiazhai

jiazhai commented Dec 8, 2019

Copy link
Copy Markdown
Member

@wolfstudy The way to fix it is right. Please help resolve sijie's comments

Signed-off-by: xiaolong.ran <rxl@apache.org>
Signed-off-by: xiaolong.ran <rxl@apache.org>
@fangpengcheng95

Copy link
Copy Markdown
Contributor

run integration tests

@wolfstudy

Copy link
Copy Markdown
Member Author

@sijie @codelipenghui PTAL

@wolfstudy

Copy link
Copy Markdown
Member Author

run integration tests

@wolfstudy

Copy link
Copy Markdown
Member Author

run integration tests
run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member Author

ping @sijie PTAL

@wolfstudy

Copy link
Copy Markdown
Member Author

run integration tests
run java8 tests

@sijie

sijie commented Dec 20, 2019

Copy link
Copy Markdown
Member

run java8 tests
run integration tests

@sijie sijie added area/broker component/storage type/bug The PR fixed a bug or issue reported a bug labels Dec 20, 2019
@sijie sijie added this to the 2.5.0 milestone Dec 20, 2019
@wolfstudy

Copy link
Copy Markdown
Member Author

org.apache.pulsar.broker.admin.AdminApiOffloadTest.testOffloadV1
org.apache.pulsar.broker.admin.AdminApiOffloadTest.testOffloadV2

run java8 tests
run integration tests

@wolfstudy

Copy link
Copy Markdown
Member Author

2019-12-20\T\13:39:01.339 [ERROR] testPerNamespaceStats(org.apache.pulsar.broker.stats.PrometheusMetricsTest) Time elapsed: 0.081 s <<< FAILURE!
java.lang.AssertionError: expected [true] but found [false]

run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member Author

run java8 tests

1 similar comment
@wolfstudy

Copy link
Copy Markdown
Member Author

run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member Author

2019-12-23\T\02:35:31.273 [ERROR] Tests run: 17, Failures: 1, Errors: 0, Skipped: 14, Time elapsed: 4.759 s <<< FAILURE! - in org.apache.pulsar.client.impl.MessageIdTest
2019-12-23\T\02:35:31.274 [ERROR] setup(org.apache.pulsar.client.impl.MessageIdTest) Time elapsed: 1.369 s <<< FAILURE!
org.apache.pulsar.broker.PulsarServerException: java.io.IOException: Failed to bind Pulsar broker on /0.0.0.0:17777
at org.apache.pulsar.broker.PulsarService.start(PulsarService.java:518)
at org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest.startBroker(MockedPulsarServiceBaseTest.java:219)
at org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest.startBroker(MockedPulsarServiceBaseTest.java:208)
at org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest.init(MockedPulsarServiceBaseTest.java:152)
at org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest.internalSetup(MockedPulsarServiceBaseTest.java:110)
at org.apache.pulsar.broker.service.BrokerTestBase.baseSetup(BrokerTestBase.java:40)
at org.apache.pulsar.client.impl.MessageIdTest.setup(MessageIdTest.java:71)

run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member Author

run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member Author

run java8 tests

@wolfstudy

Copy link
Copy Markdown
Member Author

2019-12-23\T\09:16:57.237 [ERROR] Tests run: 24, Failures: 1, Errors: 0, Skipped: 20, Time elapsed: 1,575.194 s <<< FAILURE! - in org.apache.pulsar.broker.loadbalance.SimpleLoadManagerImplTest
2019-12-23\T\09:16:57.238 [ERROR] setup(org.apache.pulsar.broker.loadbalance.SimpleLoadManagerImplTest) Time elapsed: 443.242 s <<< FAILURE!
java.io.IOException: Couldn't connect to zookeeper server
at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble$ZKConnectionWatcher.waitForConnection(LocalBookkeeperEnsemble.java:466)
at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.initializeZookeper(LocalBookkeeperEnsemble.java:209)
at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.start(LocalBookkeeperEnsemble.java:375)
at org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble.start(LocalBookkeeperEnsemble.java:384)
at org.apache.pulsar.broker.loadbalance.SimpleLoadManagerImplTest.setup(SimpleLoadManagerImplTest.java:128)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)

run java8 tests

@wolfstudy
wolfstudy merged commit c635d08 into apache:master Dec 23, 2019
@wolfstudy
wolfstudy deleted the xiaolong/legers_NPE branch December 23, 2019 12:54
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
## Motivation
when ledgers.ceilingKey return a NULL value, we need to process the ledgerId is NUll case.

## Modifications
change long ledgerId to Long ledgerId and check if ledgerId is NULL.
PositionImpl startReadOperationOnLedger(PositionImpl position) {
long ledgerId = ledgers.ceilingKey(position.getLedgerId());
PositionImpl startReadOperationOnLedger(PositionImpl position, OpReadEntry opReadEntry) {
Long ledgerId = ledgers.ceilingKey(position.getLedgerId());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change maybe not fix npe, it will cause new npe problem.
see this pr line_1800. if ledgerId is null, unbox will cause npe. And opReadEntry callback didn't put ctx, the callback process need use it, npe again.

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

Labels

area/broker type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pulsar Broker restart fail owing to create functions/assignments topic fail

6 participants