Proof of library bug vs developer side application bug
- by Paralife
I have a problem with a specific java client library. I wont say here the problem or the name of the library because my question is a different one. Here is the situation:
I have made a program that uses the library. The program is a class named 'WorkerThread' that extends Thread. To start it I have made a Main class that only contains a main() function that starts the thread and nothing else. The worker uses the library to perform comm with a server and get results.
The problem appears when I want to run 2 WorkerThreads simultaneously. What I first did was to do this in the Main class:
public class Main
{
public static void main(String args[])
{
new WorkerThread().start(); // 1st thread.
new WorkerThread().start(); // 2nd thread.
}
}
When I run this, both threads produce irrational results and what is more , some results that should be received by 1st thread are received by the 2nd instead.
If instead of the above, I just run 2 separate processes of one thread each, then everything works fine.
Also:
1.There is no static class or method used inside WorkerThread that could cause the problem. My application consists of only the worker thread class and contains no static fields or methods
2.The library is supposed to be usable in a multithreaded environment. In my thread I just create a new instance of a library's class and then call methods on it. Nothing more.
My question is this:
Without knowing any details of my implementation, is the above situation and facts enough to prove that there is a bug in the library and not in my programm? Is it safe to assume that the library inside uses a static method or object that is indirectly shared by my 2 threads and this causes the problem? If no then in what hypothetical situation could the bug originate in the worker class code?