I've spent 3 days debugging one very obscure bug in a library made by my colleague, this bug happens very infrequently. After all I found that this bug happens due to cross-thread access to an object without any lock. Actually this is not a first bug of this kind, there were similar bugs before. He just runs his unit tests, and if something fails puts somewhere a lock. And if nothing fails, ughm, then his code is perfect. It seems he has no idea about threading safety. I'm 100% sure there are many similar bugs that just haven't surfaced yet. It seems PM doesn't understand threading stuff too.
The problem is, he works much more time in the company than I do. Anyway, I can't just say "this guy is incompetent in this area", because this always shows you as a "bad team player", etc.
Any ideas, what I can do?
|
|
|||||||||||
|
closed as not constructive by gnat, Walter, GrandmasterB, Robert Harvey, Bernard Apr 23 '12 at 15:34
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
|
Convince PM that to avoid such bugs, the know-how of the team about threading stuff should be improved, and tell them that you are willing to organize something like a workshop or a presentation about it. Don't make it a personal thing between you and your colleague. |
|||||||||
|
|
Write a unit test that shows the bug and ask him to fix it. |
|||||||||||||||||||
|
|
|||||||||||||||
|
|
I think your company should not be using multithreading. After doing a massively multithreaded project, I found two techniques were critical to making things work. First, the code had to be written right. Every field had to be manually checked to make sure it was declared properly and properly synchronized whereever referenced. (Warning: I am simplifying things a bit here to keep my answer short--or at any rate, shorter.) Second, the code had to be tested by running it flat out on single and multicore machines--many minutes using 100% of each core. (And if it only uses 2% of each core, as it often did for me, that's a bug too.) You might be able to manage this, but your organization can't. Even if they understood the problem, which they don't, they don't have the expertise. Most languages provide ways to avoid this. If you have a socket reader, which usually has its own thread, have it get the info to the main thread as quickly and simply as possible. Better yet, look for system classes/functions that will handle the thread-part of the reading for you. Use a queue that runs "events" one after the other, like most GUI API's do. (Use the GUI API's event queue itself, for that matter.) If you need parallel processing, you can probably find some kind of "worker thread" that will let you keep data/fields in a single thread, handling all transfers for you. Emphasise to all the dangers of multithreading. (Scary stories: My favorite bug involved a couple of lines like: I'm not real sure how multithreading should be handled. If the job can be given to one person, and everything they do thrown away if they fail, fine. But a team is only going to be as strong as its weakest member, and even a good programmer will have trouble with full-blown multithreading. I hope the language people will find a way to make it safe. I have seen some helpful software out there. But I think it best to avoid multithreading unless execution time is critical and a good programmer or a proven team is available. |
|||
|
|
