I'm not sure at which point it hangs, but I have set up an example that I
think mimics what happens with my application. In this example the mutatee
hangs after creating 32294 threads. I'm using the latest master version.
Thanks,
Gerard
2015-02-16 18:51 GMT+01:00 Bill Williams <[email protected]>:
> On 02/16/2015 10:35 AM, Gerard wrote:
>
>> Hi,
>>
>> I'm having another problem. I increased the MAX_THREADS variable to
>> 10240 because I need to instrument a mutatee that creates around 10000
>> threads. After increasing the variable I could instrument the mutatee
>> without problems, but I added more snippets and the process hung again,
>> this time after creating 3999 threads. Now, it doesn't matter if I
>> increase even more the constant, it still hangs.
>>
>> Is there any other reason why the mutatee could hang or is there any
>> other limit somewhere?
>>
>> I'm not aware of other hardcoded limits, and if you already had tramp
> guards disabled, it seems likely that you're running into some form of bad
> behavior at scale that's independent of MAX_THREADS.
>
> Is it possible for you to put together a simple reproducer
> (mutator/mutatee) and send that to me? Do you know whether the process is
> hanging at a particular point (thread creation/destruction, process exit)?
>
> Thanks,
>>
>> Gerard
>>
>> 2015-02-04 11:22 GMT+01:00 Gerard <[email protected]
>> <mailto:[email protected]>>:
>>
>> Thanks! That was exactly the problem. I have increased the constant
>> MAX_THREADS and now I don't have this problem anymore. Is there any
>> reason why the constant is set to 32 instead of a higher value?
>>
>> I also have tried to find how to dynamically change
>> the DYNINST_max_num_threads value but I haven't found where is it
>> implemented (version 8.2.1). And about disabling tramp guards, I
>> already had them disabled so it seems that this workaround does not
>> solve the problem.
>>
>> Gerard
>>
>> 2015-02-03 20:13 GMT+01:00 Barton Miller <[email protected]
>> <mailto:[email protected]>>:
>>
>> Disabling tramp guards certainly works if you really know that
>> you're not recursing. That can be subtle and error prone, which
>> is why tramp guards were invented. Proceed cautiously here.
>>
>> --bart
>>
>>
>> On 2/3/2015 12:02 PM, Matthew LeGendre wrote:
>>
>> Another possible fix may be to disable tramp guards. Tramp
>> guards are used to prevent recursive instrumentation. For
>> example, if you instrument malloc() with instrumentation
>> that calls malloc(), then tramp guards will prevent you from
>> going into infinite recursion.
>>
>> If you already know that your instrumentation can't
>> infinitely recurse,
>> then disabling tramp guards will give a big performance win
>> and may work around this hang. To disable tramp guards, put
>> a call to BPatch::setTrampRecursive(__true) before you
>> insert instrumentation.
>>
>> -Matt
>> _________________________________________________
>> Dyninst-api mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.cs.wisc.edu/__mailman/listinfo/dyninst-api
>> <https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api>
>>
>>
>> _________________________________________________
>> Dyninst-api mailing list
>> [email protected] <mailto:[email protected]>
>> https://lists.cs.wisc.edu/__mailman/listinfo/dyninst-api
>> <https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api>
>>
>>
>>
>>
>>
>> _______________________________________________
>> Dyninst-api mailing list
>> [email protected]
>> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>>
>>
>
> --
> --bw
>
> Bill Williams
> Paradyn Project
> [email protected]
>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
static int i = 0;
void *dummy_thread(void *v)
{
printf("%d\n", i++);
pthread_exit(NULL);
}
int main(int argc, char const *argv[])
{
while (1) {
pthread_t dummy_t;
pthread_create(&dummy_t, NULL, dummy_thread, NULL);
pthread_join(dummy_t, NULL);
}
return 0;
}#include "BPatch.h"
#include "BPatch_addressSpace.h"
#include "BPatch_process.h"
#include "BPatch_binaryEdit.h"
#include "BPatch_function.h"
#include "BPatch_point.h"
#include "BPatch_flowGraph.h"
#define DYNINSTAPI_RT_LIB "/usr/local/lib64/libdyninstAPI_RT.so"
BPatch bpatch;
int main(int argc, char const *argv[])
{
setenv("DYNINSTAPI_RT_LIB", DYNINSTAPI_RT_LIB, 0);
bpatch.setTrampRecursive(true);
bpatch.setSaveFPR(false);
char const *mutatee_argv[] = {
"mutatee",
NULL
};
BPatch_addressSpace *app = bpatch.processCreate("./mutatee", mutatee_argv);
BPatch_process *appProc = dynamic_cast<BPatch_process *>(app);
appProc->continueExecution();
while(!appProc->isTerminated()){
bpatch.waitForStatusChange();
}
return 0;
}_______________________________________________
Dyninst-api mailing list
[email protected]
https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api