usnistgov / jsip

JSIP: Java SIP specification Reference Implementation (moved from java.net)
Other
287 stars 130 forks source link

"nesting_level" class level variable in ParserCore class should be atomic to avoid data inconsistency. #46

Open jagagit opened 5 years ago

jagagit commented 5 years ago

I was testing our voip java application with jain-sip-sdp-1.2.111. After two months,parsing didnt happened because of nesting_level had gone minus value.i just checked source code.it seems that nesting_level variable are static variable.

vladimirralev commented 5 years ago

Yeah nesting_level is meant for debugging parsing logic in single-threaded tests. You should be able to avoid issues like this if you disable parsing debug flag. nesting_level is almost useless in multithreaded code anyway. But it is a fair point, I can see it will cause a lot of trouble in multithreaded debug so at least it shouldn't go that bad.

If you want to send a pull request please go ahead, otherwise I will send in the patch tomorrow.

jagagit commented 5 years ago

bro .I found that HeaderParser class does not have condition as debug enabled or not. and it directly invoke dbg_enter("wkday"); method. I dont know how many class like this.

vladimirralev commented 5 years ago

Ouch. Good catch. Alright, I couldn't find other classes either by scanning quickly. I will figure something else out. Feel free to make a pull request for both anyway. Thanks.