Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 16946 invoked from network); 7 Jun 2005 17:03:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Jun 2005 17:03:19 -0000 Received: (qmail 60120 invoked by uid 500); 7 Jun 2005 17:03:16 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 60097 invoked by uid 500); 7 Jun 2005 17:03:15 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 60065 invoked by uid 99); 7 Jun 2005 17:03:15 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from 10.21.96-84.rev.gaoland.net (HELO mail.anyware-tech.com) (84.96.21.10) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 07 Jun 2005 10:03:14 -0700 Received: from localhost (localhost [127.0.0.1]) by mail.anyware-tech.com (Postfix) with ESMTP id A75EE34918 for ; Tue, 7 Jun 2005 19:03:00 +0200 (CEST) Received: from mail.anyware-tech.com ([127.0.0.1]) by localhost (trinity [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24394-07 for ; Tue, 7 Jun 2005 19:02:58 +0200 (CEST) Received: from [10.0.0.27] (poukram.anyware [10.0.0.27]) by mail.anyware-tech.com (Postfix) with ESMTP id B0BBF34915 for ; Tue, 7 Jun 2005 19:02:58 +0200 (CEST) Message-ID: <42A5D341.5000306@apache.org> Date: Tue, 07 Jun 2005 19:02:57 +0200 From: Sylvain Wallez Organization: Anyware Technologies User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Weird multithreading bug in Cron block Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at anyware-tech.com X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi all, I'm currently working on a publication application with complex database queries where we want to prefetch some of the pages linked to by the page currently being produced, in order to speed up response time on pages that are likely to be asked for by users. To achieve this, we have a "PrefetchTransformer" that grabs elements having a prefetch="true" attribute and starts a background job to load the corresponding "src" or "href" URL using a "cocoon:". At first I used JobScheduler.fireJob() to schedule for immediate execution, but went into *weird* bugs with strange NPEs all around in pipeline components. After analysis, it appeared that while the scheduler thread was processing the pipeline, the http thread was recycling the *background environment*, thus nulling the object model and other class attributes used by pipeline components. I spent the *whole day* trying to find the cause for this, without success (how frustrating). Then I decided to try another approach and use JobScheduler.fireJobAt(new Date()), meaning "schedule the job for later execution... now!". And it worked! Weird, weird, weird! Anybody having a hint about why fireJob() is doing this environment mixture? Sylvain -- Sylvain Wallez Anyware Technologies http://apache.org/~sylvain http://anyware-tech.com Apache Software Foundation Member Research & Technology Director