[Stackless] bad version in CVS

Jeff Senn senn at maya.com
Tue Sep 24 16:38:28 CEST 2002


Christian Tismer <tismer at tismer.com> writes:
> Pulling out the current tasklet isn't that bad.
> You can re-insert and run it immediately by t.run() .
> run() inserts if necessary, and then rotates the wheel
> of tasklets to make it currrent.

Ah -- but t.run() schedules immediately, yes?  What if the task is one
that will not yield (there is no interrupt as in run_watchdog) ?

Do I want something like: 

 t.make_runnable_next()  or
 t.insert(at_beginning=1) ??

> The area of real threads hasn't been touched in depth,
> yet. I'm going to work on this. There is already some
> code checking for incompatible tstate values, so I
> *hope* switching will simply be refused if you try to
> use channels between real threads. (This should become
> a nice mechanism which does the right thing, not even
> between threads, but also os tasks, processors, different
> machines.... later).

Yes -- I hope I am not doing this -- but it is complicated so
I am not sure -- today I will look.

> What I'm wondering about is how my recent changes
> can influence your code. 
...
> You don't get the crash when you don't exchange tasklets?
> Do you think the order plays a role? That might indicate
> that something bad happens with C stacks.

Maybe -- it *seems* like I don't crash if I allow voluntary
scheduling.  (This is not a good solution for me because I have some
tasks that run for a long time... so I can't test completely this
way...)

> Can you please give me your platform and compiler version?

Win2k, MS VC++ 6.0  (I will try linux/gcc sometime today if I get a
chance...)

> It should be possible to provoke such an error without
> involving a larger Tk application.

I hope so...  Essentially this is what I am doing...(very simplified!)

eventq = Queue.Queue()

Main thread:
  tk.mainloop()
   ...
    ...
     eventq.put(stuff)
   ...

I/O thread:
  ...
    x = socket.read()
    eventq.put(stuff)
  ...

Tasklet thread:
  while 1:
    free_schedule()
    event = eventq.get()
    process_event_and_start_new_or_wake_old_tasklets(event)

The crash is in the tasklet thread -- in a somewhat random place --
and it looks like the stack is messed up... (example below, in case
you can tell anything) 

More later...

-- 
-Jas

---snip---
PyNumber_CoerceEx(_object * * 0x013ff7b0, _object * * 0x013ff7b4) line 1425 + 7 bytes
try_3way_compare(_object * 0x00bd9660, _object * 0x1e0ad0e8 __Py_NoneStruct) line 492 + 15 bytes
do_richcmp(_object * 0x00bd9660, _object * 0x1e0ad0e8 __Py_NoneStruct, int 0x00000002) line 834 + 8 bytes
PyObject_RichCompare(_object * 0x1e0155f4, _object * 0x00bd9660, int 0x1e0ad0e8) line 913 + 8 bytes
cmp_outcome(int 0x00000002, _object * 0x00bd9660, _object * 0x1e0ad0e8 __Py_NoneStruct) line 3549 + 16 bytes
PyEval_EvalFrame(_frame * 0x1e067718) line 1845 + 8 bytes
slp_eval_frame(_frame * 0x00ba8128) line 288 + 6 bytes
PyEval_EvalCodeEx(PyCodeObject * 0x1e014cd4, _object * 0x00c59fc0, _object * 0x00000003, _object * * 0x00ba8128, int 0x00b4b174, _object * * 0x00000003, int 0x00b4b180, _object * * 0x00000000, int 0x00000000, _object * 0x00000000) line 2623 + 6 bytes
fast_function(_object * 0x1e012d80, _object * * * 0x00c13060, int 0x013ff918, int 0x00000003, int 0x00000003) line 3214 + 50 bytes
PyEval_EvalFrame(_frame * 0x1e067718) line 2059 + 29 bytes
slp_eval_frame(_frame * 0x00b4b018) line 288 + 6 bytes
PyEval_EvalCodeEx(PyCodeObject * 0x1e014cd4, _object * 0x00c4c948, _object * 0x00000002, _object * * 0x00b4b018, int 0x00be1228, _object * * 0x00000002, int 0x00be1230, _object * * 0x00000000, int 0x00000000, _object * 0x00000000) line 2623 + 6 bytes
fast_function(_object * 0x1e012d80, _object * * * 0x00c44eb0, int 0x013ffa00, int 0x00000002, int 0x00000002) line 3214 + 50 bytes
PyEval_EvalFrame(_frame * 0x1e067718) line 2059 + 29 bytes
slp_eval_frame(_frame * 0x00be10b8) line 288 + 6 bytes
PyEval_EvalCodeEx(PyCodeObject * 0x1e014cd4, _object * 0x00c4cb38, _object * 0x00000002, _object * * 0x00be10b8, int 0x00bf3a00, _object * * 0x00000002, int 0x00bf3a08, _object * * 0x00000000, int 0x00000000, _object * 0x00000000) line 2623 + 6 bytes
fast_function(_object * 0x1e012d80, _object * * * 0x00c44e68, int 0x013ffae8, int 0x00000002, int 0x00000002) line 3214 + 50 bytes
PyEval_EvalFrame(_frame * 0x1e067718) line 2059 + 29 bytes
slp_eval_frame(_frame * 0x00bf38a0) line 288 + 6 bytes
PyEval_EvalCodeEx(PyCodeObject * 0x1e014cd4, _object * 0x00c5b960, _object * 0x00000003, _object * * 0x00bf38a0, int 0x00bede58, _object * * 0x00000003, int 0x00bede64, _object * * 0x00000000, int 0x00000000, _object * 0x00000000) line 2623 + 6 bytes
fast_function(_object * 0x1e012d80, _object * * * 0x00c131c8, int 0x013ffbd0, int 0x00000003, int 0x00000003) line 3214 + 50 bytes
PyEval_EvalFrame(_frame * 0x1e067718) line 2059 + 29 bytes
slp_eval_frame(_frame * 0x00bedce8) line 288 + 6 bytes
PyEval_EvalCodeEx(PyCodeObject * 0x1e014cd4, _object * 0x00bb8f90, _object * 0x00000003, _object * * 0x00bedce8, int 0x00b5d090, _object * * 0x00000003, int 0x00b5d09c, _object * * 0x00000000, int 0x00c4810c, _object * 0x00000002) line 2623 + 6 bytes
fast_function(_object * 0x1e012d80, _object * * * 0x016d5f80, int 0x013ffcb8, int 0x00000003, int 0x00000003) line 3214 + 50 bytes
PyEval_EvalFrame(_frame * 0x1e067718) line 2059 + 29 bytes
slp_eval_frame(_frame * 0x00b5cf30) line 288 + 6 bytes
PyEval_EvalCodeEx(PyCodeObject * 0x1e039320, _object * 0x00c5a3e0, _object * 0x00000001, _object * * 0x00b5cf30, int 0x00ca2a0c, _object * * 0x00000001, int 0x00000000, _object * * 0x00000000, int 0x00000000, _object * 0x00000000) line 2623 + 6 bytes
function_call(_object * 0x1e006d0c, _object * 0x00c130a8, _object * 0x00ca2a00) line 379 + 49 bytes
PyObject_Call(_object * 0x00c130a8, _object * 0x00ca2a00, _object * 0x00000000) line 1684 + 14 bytes
instancemethod_call(_object * 0x1e006d0c, _object * 0x00c7df38, _object * 0x00752670) line 2276 + 12 bytes
PyObject_Call(_object * 0x00c7df38, _object * 0x00752670, _object * 0x00000000) line 1684 + 14 bytes
PyEval_CallObjectWithKeywords(_object * 0x00c7df38, _object * 0x00752670, _object * 0x00000000) line 3099 + 12 bytes
builtin_apply(_object * 0x00000000, _object * 0x00c7df38) line 95 + 16 bytes
PyCFunction_Call(_object * 0x1e012cba, _object * 0x00000002, _object * 0x016f9700) line 80 + 4 bytes
PyEval_EvalFrame(_frame * 0x1e1a2789) line 2038 + 13 bytes
slp_run_tasklet(_frame * 0x00c5cd98) line 309 + 7 bytes
slp_eval_frame(_frame * 0x016d5c70) line 288
PyEval_EvalCodeEx(PyCodeObject * 0x1e039320, _object * 0x00c50e60, _object * 0x00c47458, _object * * 0x00c3a2e0, int 0x0075267c, _object * * 0x00000000, int 0x00000000, _object * * 0x00000000, int 0x00000000, _object * 0x00000000) line 2623 + 6 bytes
function_call(_object * 0x1e006d0c, _object * 0x00c368a0, _object * 0x00752670) line 379 + 49 bytes
PyObject_Call(_object * 0x00c368a0, _object * 0x00752670, _object * 0x00000000) line 1684 + 14 bytes
PyEval_CallObjectWithKeywords(_object * 0x00c368a0, _object * 0x00752670, _object * 0x00000000) line 3099 + 12 bytes

_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless



More information about the Stackless mailing list