Traversal limit seems to be broken for me in Python?

268 views
Skip to first unread message

Dmitry Chichkov

unread,
Jun 9, 2016, 11:55:54 AM6/9/16
to Cap'n Proto
It looks like that with capnp 0.5.3 / current pycapnp from pip, the traversal limit setting from Python is broken.

The following code that attempts to access 500Mb file:
   dataset = dataset_capnp.Dataset.read(open(sys.argv[1]), traversal_limit_in_words = 2^61)

Fails with:
   Traceback (most recent call last):
  File "./display.py", line 41, in <module>
    dataset = dataset_capnp.Dataset.read(open(sys.argv[1]), traversal_limit_in_words = 2^61)
  File "capnp/lib/capnp.pyx", line 2885, in capnp.lib.capnp._StructModule.read (capnp/lib/capnp.cpp:61419)
  File "capnp/lib/capnp.pyx", line 3399, in capnp.lib.capnp._StreamFdMessageReader.__init__ (capnp/lib/capnp.cpp:68129)
capnp.lib.capnp.KjException: src/capnp/serialize.c++:179: failed: expected totalWords <= options.traversalLimitInWords; Message is too large.  To increase the limit on the receiving end, see capnp::ReaderOptions.
stack: 0x7fd2148f1ec9 0x7fd2148f57ed 0x7fd214d84044 0x7fd2155980eb 0x5039eb 0x7fd2155965e2 0x499be5 0x4a1634 0x44e4a5 0x44ec9f 0x44f904 0x7fd2169eaec5 0x578c4e


Is there a way to disable traversal limit permanently for a given .capnp file?    Or, if possible, disable it permanently across the library?

Thanks,
Dmitry

P.S.   Having traversal limit doesn't make any sense at all for our application. We just read data from previously generated files.... 
P.P.S.  Enabling it by default for 0.4 -> 0.5 had broken code for us. It was a nasty surprise.

Kenton Varda

unread,
Jun 13, 2016, 10:08:06 PM6/13/16
to Dmitry Chichkov, Cap'n Proto
Hi Dmitry,

I think you meant 2**61 rather than 2^61. In Python, ^ is the XOR operator, so 2^61 would be 63, a rather low limit. :)

-Kenton

--
You received this message because you are subscribed to the Google Groups "Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capnproto+...@googlegroups.com.
Visit this group at https://groups.google.com/group/capnproto.

Reply all
Reply to author
Forward
0 new messages