Issue 60 in dpkt: analyzing packet causes memory leak

37 views
Skip to first unread message

dp...@googlecode.com

unread,
Jan 20, 2011, 11:26:48 AM1/20/11
to dp...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 60 by kyle.creyts: analyzing packet causes memory leak
http://code.google.com/p/dpkt/issues/detail?id=60

What steps will reproduce the problem?
1. open packet with dpkt.pcap.Reader
2. push it into dpkt.ethernet.Ethernet
3. watch Memory be consumed.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
dpkt 1.7, Centos 5.5

Please provide any additional information below.

Attachments:
badpacket.pcap 142 bytes

dp...@googlecode.com

unread,
Jan 20, 2011, 11:30:51 AM1/20/11
to dp...@googlegroups.com

Comment #1 on issue 60 by kyle.creyts: analyzing packet causes memory leak
http://code.google.com/p/dpkt/issues/detail?id=60

packet appears fragmented, has bad checksum

dp...@googlecode.com

unread,
Jan 20, 2011, 11:35:54 AM1/20/11
to dp...@googlegroups.com

Comment #2 on issue 60 by kyle.creyts: analyzing packet causes memory leak
http://code.google.com/p/dpkt/issues/detail?id=60

File "./myscript.py", line 46, in <module>
eth = dpkt.ethernet.Ethernet(buf)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/ethernet.py", line 79,
in unpack
self._unpack_data(self.data)
File "/usr/local/lib/python2.6/site-packages/dpkt/ethernet.py", line 70,
in _unpack_data
self.data = self._typesw[self.type](buf)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/ip.py", line 60, in
unpack
self.data = self._protosw[self.p](buf)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/icmp.py", line 103, in
unpack
self.data = self._typesw[self.type](self.data)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/icmp.py", line 85, in
unpack
self.data = self.ip = ip.IP(self.data)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/ip.py", line 60, in
unpack
self.data = self._protosw[self.p](buf)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/gre.py", line 73, in
unpack
sre = self.SRE(self.data)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 72, in
__init__
self.unpack(args[0])
File "/usr/local/lib/python2.6/site-packages/dpkt/gre.py", line 45, in
unpack
dpkt.Packet.unpack(self, buf)
File "/usr/local/lib/python2.6/site-packages/dpkt/dpkt.py", line 127, in
unpack
struct.unpack(self.__hdr_fmt__, buf[:self.__hdr_len__])):

dp...@googlecode.com

unread,
Jan 25, 2011, 5:57:07 PM1/25/11
to dp...@googlegroups.com

Comment #3 on issue 60 by kyle.creyts: analyzing packet causes memory leak
http://code.google.com/p/dpkt/issues/detail?id=60

issue was fixed in August.

dp...@googlecode.com

unread,
Jan 25, 2011, 6:14:02 PM1/25/11
to dp...@googlegroups.com

Comment #4 on issue 60 by dugsong: analyzing packet causes memory leak
http://code.google.com/p/dpkt/issues/detail?id=60

What was actually fixed? Python is an interpreted language, and until 2.5,
only grew in its memory usage (no free'ing of GC'd memory). Let me know if
we should close this out...

dp...@googlecode.com

unread,
Jan 25, 2011, 6:41:25 PM1/25/11
to dp...@googlegroups.com

Comment #5 on issue 60 by kyle.creyts: analyzing packet causes memory leak
http://code.google.com/p/dpkt/issues/detail?id=60

Go ahead and close it.
Without the fix, python would get stuck in an infinite loop where it would
repeatedly append self.SRE(self.data) to l, and this would cause python's
mem use to grow to fill all available memory, both physical and swap.
Memory leak was not the proper term.

diff with fix:
1c1
< # $Id: gre.py 30 2007-01-27 03:10:09Z dugsong $
---
> # $Id: gre.py 75 2010-08-03 14:42:19Z jon.oberheide $
73a74
> self.data = self.data[len(sre):]
78,79d78
< skip = sum(map(len, self.sre))
< self.data = self.data[skip:]


dp...@googlecode.com

unread,
Nov 3, 2011, 12:13:16 PM11/3/11
to dp...@googlegroups.com

Comment #6 on issue 60 by rrpo...@gmail.com: analyzing packet causes memory
leak
http://code.google.com/p/dpkt/issues/detail?id=60

Issue still exists....
Python ver 2.6
Dpkt ver 1.7

Reply all
Reply to author
Forward
0 new messages