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

Bug#235668: Returning false from pkgAcquireStatus::Pulse does not cleanly shut down a download.



# These are both about the flood of "Tried to dequeue a fetching object" errors
severity 235668 minor
merge 235668 234685
thanks

On Mon, Mar 01, 2004 at 02:41:01PM -0500, Daniel Burrows wrote:

> On Mon, Mar 01, 2004 at 12:18:33AM -0700, Jason Gunthorpe <jgg@debian.org> was heard to say:
> > 
> > On Sun, 29 Feb 2004, Daniel Burrows wrote:
> > 
> > >   What is the correct way for an apt frontend to cancel a download?  The
> > > obvious thing from reading the header files is to return false from
> > > the Pulse method of the status object, but this results in a large
> > > number of errors:
> > 
> > IIRC this is it.
> > 
> > But this is the firt time ever that someone has tried to use it, and it
> > looks like it has a bug.
> > 
> > It looks to me like I just forgot to clear out the item Status while
> > blowing everything away.
> 
>   Ok, I wasn't sure if that was the case. [0] I'll report this as a bug
> then.
> 
>   Daniel
> 
>   [0] I vaguely remember getting inconclusive answers about this a few
>       years back, but I may have been asking the wrong questions, or
>       asking in the wrong place.

I'm not entirely clear on the right way to fix this.  The relevant code
seems to be:

	 if (Log != 0 && Log->Pulse(this) == false)
	 {
	    WasCancelled = true;
	    break;
	 }
      }      
   }   

   if (Log != 0)
      Log->Stop();
   
   // Shut down the acquire bits
   Running = false;
   for (Queue *I = Queues; I != 0; I = I->Next)
      I->Shutdown(false);

   // Shut down the items
   for (ItemIterator I = Items.begin(); I != Items.end(); I++)
      (*I)->Finished(); 
   
   if (_error->PendingError())
      return Failed;
   if (WasCancelled)
      return Cancelled;
   return Continue;
}

It's the Shutdown() bit that ends up spewing these errors, right?  So before
doing that, we need to go through the items and set their status to
StatError or something?

-- 
 - mdz



Reply to: