Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

NetStore.getAsync will fail with NPE under certain conditions #906

Open
codepitbull opened this issue Jul 7, 2017 · 0 comments
Open

NetStore.getAsync will fail with NPE under certain conditions #906

codepitbull opened this issue Jul 7, 2017 · 0 comments

Comments

@codepitbull
Copy link

I was trying to upgrade ethereumj to Netty 4.1 and found the following issue which I think is also a bug with the current version.
There is a DefaultPromise being constructed without an executor, sidestepping the actual intention of this class in Netty:
public synchronized Future<Chunk> getAsync(Key key) { Chunk chunk = localStore.get(key); Promise<Chunk> ret = new DefaultPromise<Chunk>() {};

Using the DefaultPromise this way only works because of a lucky combination of checks in Netty.
Due to another check in DefaultPromise.notifyListeners this issue only ever causes problems if a listener has been registered. This lucky combo is gone in Netty 4.1.

To see what I mean run BzzProtocolTest.simpleTest in the current version. The test will work.
Now update to Netty to 4.1.13 and run again and you will see the NPE.

I currently have no good idea what the correct executor might be in this situation.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants