Re: RuntimeError: dictionary changed size during iteration

Sophana K <[email protected]> Sat, 8 Dec 2012 09:51:21 +0100
Newsgroups gmane.comp.python.webware
Message-ID <CADP5dB5Drz-OZCk4HFUBG2wbv3JAdSTy+-34EAiiaTiUs-LaXg@mail.gmail.com>
--===============4659948017656912635==
Content-Type: multipart/alternative; boundary=e89a8f22bd89b68f4904d0536f96

--e89a8f22bd89b68f4904d0536f96
Content-Type: text/plain; charset=ISO-8859-1

My tasks do not access the sessions. (Why would they?)
As it is a new behaviour, (I was using 0.9) a look at the changes could
help...
Could it be the scheduler instances sharing some global task lists?


On Fri, Dec 7, 2012 at 2:38 PM, Christoph Zwerschke <[email protected]> wrote:

> Am 07.12.2012 12:16, schrieb Sophana K:
> > Yes, I'm creating a Scheduler instance.
> > I didn't know I was supposed to use the one from the application.
>
> It's ok to create your own instance. But then the two schedulers will
> run as two parallel threads which needs more ressources and you can get
> these race conditions if both schedulers have tasks which access the
> session store. It's also convenient to use the application.taskManager()
> because it's started and stopped automatically together with the
> application.
>
> > Is it normal that a scheduler instance automatically does session
> sweeping?
> > Shouldn't the application create the task explicitely?
>
> But that's excactly how it works. The application creates its own
> scheduler, and then adds just one task, the one which is used for
> session sweeping. You can replace that task with your own or add more
> tasks if you like.
>
> > I have now fixed my code to use the existing scheduler.
> > Shouldn't you remove the previous fixes then?
>
> The fixes are still helpful in case anybody changes the session store
> for whatever maybe valid reasons.
>
> It's still unclear to me what caused your problems: Do your own tasks
> modify the session store? Then that's the explanation, because you ran
> them in a parallel scheduler. If your own tasks don't change the
> session, then you must continue searching for the error cause. It looks
> like the session sweeper thread somehow was duplicated, but how this
> happens is unclear to me without seeing your code. If you just create
> your own Scheduler instance, this should not happen.
>
> -- Christoph
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Webware-discuss mailing list
> Webware-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>

--e89a8f22bd89b68f4904d0536f96
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

My tasks do not access the sessions. (Why would they?)<div>As it is a new b=
ehaviour, (I was using 0.9) a look at the changes could help...</div><div>C=
ould it be the scheduler instances sharing some global task lists?</div>
<div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Fri, Dec 7=
, 2012 at 2:38 PM, Christoph Zwerschke <span dir=3D"ltr">&lt;<a href=3D"mai=
lto:[email protected]" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<=
br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex">
Am 07.12.2012 12:16, schrieb Sophana K:<br>
<div class=3D"im">&gt; Yes, I&#39;m creating a Scheduler instance.<br>
&gt; I didn&#39;t know I was supposed to use the one from the application.<=
br>
<br>
</div>It&#39;s ok to create your own instance. But then the two schedulers =
will<br>
run as two parallel threads which needs more ressources and you can get<br>
these race conditions if both schedulers have tasks which access the<br>
session store. It&#39;s also convenient to use the application.taskManager(=
)<br>
because it&#39;s started and stopped automatically together with the<br>
<div class=3D"im">application.<br>
<br>
&gt; Is it normal that a scheduler instance automatically does session swee=
ping?<br>
&gt; Shouldn&#39;t the application create the task explicitely?<br>
<br>
</div>But that&#39;s excactly how it works. The application creates its own=
<br>
scheduler, and then adds just one task, the one which is used for<br>
session sweeping. You can replace that task with your own or add more<br>
tasks if you like.<br>
<div class=3D"im"><br>
&gt; I have now fixed my code to use the existing scheduler.<br>
&gt; Shouldn&#39;t you remove the previous fixes then?<br>
<br>
</div>The fixes are still helpful in case anybody changes the session store=
<br>
for whatever maybe valid reasons.<br>
<br>
It&#39;s still unclear to me what caused your problems: Do your own tasks<b=
r>
modify the session store? Then that&#39;s the explanation, because you ran<=
br>
them in a parallel scheduler. If your own tasks don&#39;t change the<br>
session, then you must continue searching for the error cause. It looks<br>
like the session sweeper thread somehow was duplicated, but how this<br>
happens is unclear to me without seeing your code. If you just create<br>
your own Scheduler instance, this should not happen.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
-- Christoph<br>
<br>
---------------------------------------------------------------------------=
---<br>
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial<br>
Remotely access PCs and mobile devices and provide instant support<br>
Improve your efficiency, and focus on delivering more value-add services<br=
>
Discover what IT Professionals Know. Rescue delivers<br>
<a href=3D"http://p.sf.net/sfu/logmein_12329d2d" target=3D"_blank">http://p=
.sf.net/sfu/logmein_12329d2d</a><br>
_______________________________________________<br>
Webware-discuss mailing list<br>
<a href=3D"mailto:Webware-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org">Webware-discuss@li=
sts.sourceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/webware-discuss" ta=
rget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/webware-discus=
s</a><br>
</div></div></blockquote></div><br></div>

--e89a8f22bd89b68f4904d0536f96--


--===============4659948017656912635==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
--===============4659948017656912635==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Webware-discuss mailing list
Webware-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/webware-discuss

--===============4659948017656912635==--