[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ecf-dev] Small problem with RegistrySharedObject#handleAddRegistration
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Thanks Scott.
I opened a bug for this one and attached patch for it:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=299849
Also I opened another bug report for RegistrySharedObject. I think we
(ECF team) should discuss about it;
https://bugs.eclipse.org/bugs/show_bug.cgi?id=299850
Scott Lewis пишет:
> Hi Pavel,
>
> Yes, this is a bug...thanks for finding. If you could open a bug report
> and attach code for fix (in patch or in comment given that it's so
> small), I'll apply.
>
> There are one or two other handle* methods in the RegistrySharedObject
> class that should probably also be adjusted similarly...just to avoid
> spurious NPEs reported to console because of thread race.
>
> Thanks,
>
> Scott
>
>
> Samolisov Pavel wrote:
> Hello folks,
>
> I find a potential bug in the method
> RegistrySharedObject#handleAddRegistration:
>
> in this code:
> if (remoteContainerID == null ||
> getLocalContainerID().equals(remoteContainerID))
> { return;
> }
> XMPPRemoteServiceAdapterFactory#XMPPRegistrySharedObject#getLocalContainerID()
>
> returns container ID as connected ID:
>
> protected ID getLocalContainerID() {
> // For XMPP, the local container ID is its connected ID.
> return getContext().getConnectedID();
> }
>
> this code returns XMPPContainer.remoteServerID
>
> But! If we will invoke method XMPPContainer.disconnect() then we will
> set remoteServerID to null and getLocalContainerID will return null. In
> RegistrySharedObject#handleAddRegistration we will have NPE.
>
> This situation can occur because we receive/handle packet in another
> (not main) thread.
>
> We can receive message in thread A, close connection in thread Main and
> begin handle received message in thread A. Therefore we can got NPE.
>
> May be we should change code in the
> RegistrySharedObject#handleAddRegistration to:
>
> ID localContainerID = getLocalContainerID();
> if (remoteContainerID == null || localContainerID == null ||
> localContainerID.equals(remoteContainerID)) {
> return;
> }
>
> Any ideas?
>
>
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev
- --
Pavel Samolisov
Meet me at:
Vkontakte.ru: http://vkontakte.ru/id3178981
Blog: http://samolisov.blogspot.com
Twitter: http://twitter.com/samolisov
XMPP/Jabber: samolisov@xxxxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAktR7goACgkQ20T0Vos3rqANtwCgwkhethQxRiDMMG76ZbiP6vzA
6EQAnjBGGT5LCrJsjqFP5RQ8Oo1qDijW
=uH07
-----END PGP SIGNATURE-----