Re: DcerpcHandle thread safety
Michael B Allen <[email protected]> Sun, 11 Jan 2015 22:25:01 -0500
| Newsgroups | gmane.network.samba.java |
|---|---|
| Message-ID | <CAGMFw4i0-6DrL9cUWir0wk7dkZB9VrrNKmfLZa3a6BJE=vysBA@mail.gmail.com> |
On Fri, Jan 9, 2015 at 4:02 AM, Mateusz KoĆodziej <[email protected]> wrote: > Hi > > Is class DcerpcHandle thread safe? > > There is a field: > > private static int call_id = 1; > > > > and a method: > > > > public void sendrecv(DcerpcMessage msg){ > > > > ... > > msg.call_id = call_id++; > > ... > > } > > > I guess it is not thread safe. Is this a bug or it will work anyway? Hi Mateusz, Yeah, that code looks dubious. In practice there are locks (bind() locks 'this') but other calls lock on different objects so it looks like it is very possible for the same call_id to be used. It might be sufficient to make call_id volatile but I think there should probably be a synchronized(this) {} around at least that one line. I have added this to the TODO list for further investigation. Thanks for reporting it. Mike -- Michael B Allen Java Active Directory Integration http://www.ioplex.com/