ironport / shrapnel

Shrapnel is a scalable, high-performance cooperative threading library for Python.
Other
219 stars 34 forks source link

python.core from packet.pyx #27

Open halayli opened 12 years ago

halayli commented 12 years ago

I saw a python.core today that came from packet.pyx. I couldn't get gdb to load the symbols properly but from the traceback it seems that it received an empty response and we proceeded to unpack it. The daemon has been running for a month or so now and that's the first time I see this issue.

https://github.com/ironport/shrapnel/blob/master/coro/dns/stub_resolver.py#L43

I added a check to make sure that the reply is not empty before we pass it to unpacker. I'll see if it happens again.

I can provide the python core if anyone is interested in it.

samrushing commented 12 years ago

Yeah, that code is relatively new and could probably use some 'fuzz' testing...

halayli commented 12 years ago

got it. No problem I'll submit a patch after I let it soak for a couple of days.

ehuss commented 12 years ago

Sam, whenever you have a "cpdef" or "cdef" function that returns a non-python value, you need to explicitly tell Cython what return value means "exception" (or "except *" to mean always check).

samrushing commented 12 years ago

I assume you're talking about getbyte()... looks a little tricky, actually, since there are no 'invalid' characters in a dns packet. How about this, have it return an 'int', declare it as "except -1"?