Showing posts with label idiot. Show all posts
Showing posts with label idiot. Show all posts

2016-05-11

Note to self #4

Next time you screw up your default file extensions as I did (executing a .bat file resulted in an IE's View Downloads window -_- ...), look here for a fix: http://www.winhelponline.com/blog/file-asso-fixes-for-windows-7/

2016-05-09

c: How not to code #1

(gdb) bt
#0  0x00007f8ac115bebe in __lll_lock_wait_private () from /lib64/libc.so.6
#1  0x00007f8ac10f22be in _L_lock_9876 () from /lib64/libc.so.6
#2  0x00007f8ac10f05c1 in free () from /lib64/libc.so.6
#3  0x0000000000402649 in handle_sig (signo=<optimized out>, info=<optimized out>, context=<optimized out>) at lol.c:158
#4  <signal handler called>
#5  0x00007f8ac10edf03 in _int_malloc () from /lib64/libc.so.6
#6  0x00007f8ac10f06b7 in malloc () from /lib64/libc.so.6
#7  0x00000000004015ba in do_the_boogie (fd=3, gp=<optimized out>) at lol.c:715
#8  0x00000000004023cc in main (argc=5, argv=<optimized out>) at lol.c:810

LOL, it is deadlocked. The signal handler (frame #4) was invoked inside a malloc (frame #5), and the signal handler calls free in frame #3. Of course, the heap lock is held in frame #5 and both are in the same memory arena (see: break space), hence we are screwed.

2016-04-22

Note to self #3

Task:
  • Measure network throughput of <your favorite dipshit 3rd party app>
  • Report traffic over granularity periods
  • C99, _GNU_SOURCE
Actions taken:
  • Using libpcap in main thread to capture packets (also filtering, etc)
  • Piping info into another thread (simple pthread usage) that does the math
Problem encountered:
  1. When emitting all the info I read from the pipe to stdout, the average packet count is 2700..3000 packet/s
  2. When only the per GP statistics, the packet capture drops to 3-11 packet/s
Extensive head scratching intensifies.

[few days had passed]

Turned out, if I print all the info, of course it captures more tcp traffic, as I'm over an SSH connection! I'm generating that traffic!!!111one

/me idiot

Don't do Java, kids. It's bad for your brains.