Skip to content

Commit

Permalink
smurf: Ignore errors if the cache free fails
Browse files Browse the repository at this point in the history
There are reports of CALCQU triggering errors during the cleanup
of the cache. I am guessing that CALCQU does not attempt to fix
up header metadata so does not initialise an early AST object in
the main thread. Later on the WVM data are calculated in threads
such that when the object is freed in the main thread at task
exit the object is invalid even though the pointer is defined.

The error message is:

!! AST: Error at line 160 in file smf_calc_wvm.c.
!  Invalid Object pointer given (value is 390951).
!  This pointer has been annulled, or the associated Object deleted.
!  Application exit status AST__OBJIN, Object invalid

which hints that my interpretation may not be the whole story.
  • Loading branch information
timj committed Jul 28, 2013
1 parent 09153f5 commit 642d9b9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion applications/smurf/libsmf/smf_calc_wvm.c
Expand Up @@ -157,7 +157,13 @@ double smf_calc_wvm( const smfHead *hdr, double approxam, AstKeyMap * extpars, i

/* See if we are required to clear any cache */
if (!hdr && approxam != VAL__BADD && approxam < 0.0) {
if (CACHE) CACHE = astAnnul( CACHE );
if (CACHE) {
CACHE = astAnnul( CACHE );
/* if we got an error ignore it. An error would indicate that we
somehow instantiated the cache in a different thread to the one we
are using to free it. */
if (*status == AST__OBJIN) errAnnul( status );
}
return VAL__BADD;
}

Expand Down Expand Up @@ -249,9 +255,14 @@ double smf_calc_wvm( const smfHead *hdr, double approxam, AstKeyMap * extpars, i
errAnnul( status );
}

smf_timerinit(&tv1,&tv2,status);

/* Get the pwv for this airmass */
wvmOpt( (float)airmass, (float)tamb, wvm, &pwv, &tau0, &twater, &rms);

printf("Called wvmOpt with %g %g %g %g : %.5f s\n", airmass, wvm[0], wvm[1], wvm[2],
smf_timerupdate(&tv1,&tv2,status));

/* Convert to zenith pwv */
pwv /= airmass;

Expand Down

0 comments on commit 642d9b9

Please sign in to comment.