Skip to content

Instantly share code, notes, and snippets.

View michelp's full-sized avatar

Michel Pelletier michelp

  • Portland, OR
View GitHub Profile
import logging
import zmq.green as zmq
from cliff.lister import Command
from cPickle import loads, dumps
class Kill(Command):
log = logging.getLogger(__name__)
def get_parser(self, prog_name):
>>> from itertools import starmap, product
>>> from operator import add
>>> list(starmap(add, product('ABC', '123')))
['A1', 'A2', 'A3', 'B1', 'B2', 'B3', 'C1', 'C2', 'C3']
>>>
>>> pprint(sorted(db.expand('sports cars', [('entity', 20, 1024, 1, 1)], language='en'), key=itemgetter(1), reverse=True))
[(u'entity:american', 943L),
(u'entity:british', 618L),
(u'entity:canada', 362L),
(u'entity:australia', 328L),
(u'entity:australian', 286L),
(u'entity:car', 120L),
(u'entity:ford', 119L),
(u'entity:"grand prix"', 112L),
(u'entity:"le mans"', 105L),
>>> pprint(sorted(db.expand('south america', [('entity', 20, 1024, 1, 1)], language='en'), key=itemgetter(1), reverse=True))
[(u'entity:"united states"', 10223L),
(u'entity:"north america"', 4504L),
(u'entity:europe', 3716L),
(u'entity:"south america"', 3124L),
(u'entity:south', 2234L),
(u'entity:mexico', 2204L),
(u'entity:americas', 1920L),
(u'entity:africa', 1820L),
(u'entity:asia', 1699L),
*** glibc detected *** /home/michel/wikiparser/.virt/bin/python: munmap_chunk(): invalid pointer: 0x0000000050eaac10 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7ffff693eb96]
/usr/lib/libxapian.so.22(_ZNSt8_Rb_treeISsSt4pairIKSs14OmDocumentTermESt10_Select1stIS3_ESt4lessISsESaIS3_EE8_M_eraseEPSt13_Rb_tree_nodeIS3_E+0x41)[0x7ffff36c3ae1]
/usr/lib/libxapian.so.22(_ZNSt8_Rb_treeISsSt4pairIKSs14OmDocumentTermESt10_Select1stIS3_ESt4lessISsESaIS3_EE8_M_eraseEPSt13_Rb_tree_nodeIS3_E+0x2f)[0x7ffff36c3acf]
/usr/lib/libxapian.so.22(_ZNSt8_Rb_treeISsSt4pairIKSs14OmDocumentTermESt10_Select1stIS3_ESt4lessISsESaIS3_EE8_M_eraseEPSt13_Rb_tree_nodeIS3_E+0x2f)[0x7ffff36c3acf]
/usr/lib/libxapian.so.22(_ZNSt8_Rb_treeISsSt4pairIKSs14OmDocumentTermESt10_Select1stIS3_ESt4lessISsESaIS3_EE8_M_eraseEPSt13_Rb_tree_nodeIS3_E+0x2f)[0x7ffff36c3acf]
/usr/lib/libxapian.so.22(_ZN6Xapian8Document8InternalD1Ev+0x39)[0x7ffff36c0ef9]
/usr/lib/libxapian.so.22(_ZN6Xapian8Document8InternalD0Ev+0x9)[0x7ffff36c0fd9]
/
Interstate 73 in South Carolina
*** glibc detected *** /home/michel/wikiparser/.virt/bin/python: free(): invalid next size (fast): 0x0000000007284e40 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7ffff693eb96]
/usr/lib/libxapian.so.22(+0x151850)[0x7ffff37c6850]
/usr/lib/libxapian.so.22(+0x13f7b9)[0x7ffff37b47b9]
/usr/lib/libxapian.so.22(_ZN6Xapian13TermGeneratorD1Ev+0x3a)[0x7ffff37fe3ea]
/usr/lib/python2.7/dist-packages/xapian/_xapian.so(+0x412f4)[0x7ffff3aa62f4]
/usr/lib/python2.7/dist-packages/xapian/_xapian.so(+0x1ccf6)[0x7ffff3a81cf6]
/home/michel/wikiparser/.virt/bin/python[0x42497d]
*** glibc detected *** /home/michel/wikiparser/.virt/bin/python: malloc(): memory corruption: 0x0000000004dbecb0 ***
^C
Program received signal SIGINT, Interrupt.
0x00007ffff69c19bb in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) where
#0 0x00007ffff69c19bb in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff6945221 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff6942fa7 in malloc () from /lib/x86_64-linux-gnu/libc.so.6
valgrind: m_mallocfree.c:288 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 320416, hi = 281474977031072.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata. If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away. Please try that before reporting this as a bug.
==30589== at 0x3804CA36: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==30589== by 0x3804CBDC: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==30589== by 0x38058FC6: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
valgrind: m_mallocfree.c:288 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 17044705, hi = 0.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata. If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away. Please try that before reporting this as a bug.
==6789== at 0x3804CA36: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==6789== by 0x3804CBDC: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==6789== by 0x38057FB0: ??? (in /usr/lib/valgrind/memcheck-amd64-linux)
==25665== Invalid write of size 1
==25665== at 0x99DBBDB: ChertTable_base::next_free_block() (chert_btreebase.cc:457)
==25665== by 0x9A07CEA: ChertTable::alter() (chert_table.cc:433)
==25665== by 0x9A0CCD0: ChertTable::add_kt(bool) (chert_table.cc:901)
==25665== by 0x9A0D462: ChertTable::add(std::string const&, std::string, bool) (chert_table.cc:1118)
==25665== by 0x99F7875: ChertPositionListTable::set_positionlist(unsigned int, std::string const&, Xapian::PositionIterator, Xapian::PositionIterator const&, bool) (chert_positionlist.cc:67)
==25665== by 0x99EF9AD: ChertWritableDatabase::add_document_(unsigned int, Xapian::Document const&) (chert_database.cc:1185)
==25665== by 0x99F1189: ChertWritableDatabase::add_document(Xapian::Document const&) (chert_database.cc:1149)
==25665== by 0x969A3F7: ??? (in /usr/lib/python2.7/dist-packages/xapian/_xapian.so)
==25665== by 0x49D584: PyEval_EvalFrameEx (in /home/michel/wikiparser/.virt/bin/python)