[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

again and again and again



Folks,

Help! I'm in a loop!

My fitting program occasionally goes into an infinite loop at present. 
When I run it under the debugger and it has fallen into the loop and I 
control-C it and backtrace it, it wakes up in JApplication.cc. Here are 
the statements that are getting repeated:

957             do{
960                     rem.tv_sec = rem.tv_nsec = 0;
961                     nanosleep(&req, &rem);
962                     if(rem.tv_sec == 0 && rem.tv_nsec == 0){
965                             int delta_NEvents = NEvents - 
GetEventBufferSize() - last_NEvents;
966                             avg_NEvents += delta_NEvents>0 ? 
delta_NEvents:0;
967                             avg_time += sleep_time;
968                             rate_instantaneous = 
(double)delta_NEvents/sleep_time;
969                             rate_average = (double)avg_NEvents/avg_time;
973                     last_NEvents = NEvents - GetEventBufferSize();
976                     if(show_ticker && loops.size()>0)PrintRate();
978                     if(SIGINT_RECEIVED)Quit();
979                     if(SIGINT_RECEIVED>=3)break;
983                     pthread_mutex_lock(&app_mutex);
986                     double rem_time = (double)rem.tv_sec + 
(1.0E-9)*(double)rem.tv_nsec;
987                     double slept_time = sleep_time - rem_time;
988                     for(unsigned int i=0;i<heartbeats.size();i++){
989                             double *hb = heartbeats[i];
990                             *hb += slept_time;
991                             if(monitor_heartbeat && (*hb > 
(THREAD_TIMEOUT-1.0)+sleep_time)){
988                     for(unsigned int i=0;i<heartbeats.size();i++){
1042                    pthread_mutex_unlock(&app_mutex);
957             do{

and so forth.

Is there any wisdom about what may have caused it? I'm not even sure 
that the above mentioned loop is the one that is causing problems. 
Probably some random memory overwrite on my part, but there may be hints 
for finding it out there, something of which I am unaware.

  -- Mark