You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pull request #71 fixes a memory leak in the code that handles all the HTTP redirect, a slow leak of one mac address string (18 bytes) worth of ram per request.
I'm basically going to use this Issue has a "let's audit all use of malloc and friends (safe_*) and make sure free is eventually called once and only once."
It's unclear that there are any outstanding memory leaks. It would be interesting to know if someone with a busy access point could run the latest code for a few days/weeks are report daily snapshot of the memory map to see if there's any unbounded growth.
I would love to see a test script which exercises wifidog. Just connect users, disconnect users etc. Probably with an authorized server which randomly sends auth: 1 and auth: 0. Then we could run valgrind.
Sweet! Do you have a test framework in mind or just use exit(1) on failure?
I'll probably try that on a fork and start writing unit tests
for various data structure handling functions (client_list, config,
AuthServer, pstring, etc.)
Yeah, it works.. almost. The vlanmac interfaces do not show up in /proc/net/arp, so I am using a custom arp table. No big problem. Almost got it working ;)
What is interesting here.. commit 6d36e51 will always log in the IP/MAC and then log it out again in 1/3 of all runs. In this settings, something seems to block inside wifidog and fire_queries.py slows down, probably because it's running into timeouts.
I can only reproduce this if I build with clang and CFLAGS="-O2 -g3", and then only sometimes. Notably, with -fno-omit-frame-pointer I only get requests running into timeouts. This looks race-condition-ish.
Meh, reproducing this is hard. It really only works with some flags, otherwise I apparently get a deadlock.
It seems that the client gets logged out properly on a manual requests and the client struct is deleted. In firewall.c, fw_sync_with_authserver subsequently re-uses the client and it crashes. I don't see the problem as all calls are properly locking the list.
I have now compiled with -fsanitize=address and that seems to give me some saner output.
On WIFIDOG-AUTH, the logout disconnecter a client (first) on the server. It transmits info at gateway only when counter update. This creates a certain latency.
Indeed, that poses problem if the client reconnect meantime because iptables rule are doubled.
@Existed if you're trying the new code can you report back on impact on memory usage and any issue(s) you encounter? Always eager for feedback from people with higher volume installs.
Activity
acv commentedon Mar 12, 2015
It's using 1540 kB of RAM in your example. That does not seem excessive. VmRSS is the actual used ram. The larger numbers are mostly virtual memory.
At peak, it used 2032 kB (VmHWM, RSS high water mark).
acv commentedon Mar 12, 2015
Derp, I didn't see the VmData... There's a leak somewhere to get that high.
acv commentedon Mar 12, 2015
Someone with a decent usage volume and a fast x86/amd64 machine should try running wifidog under valgrind.
acv commentedon Mar 12, 2015
Pull request #71 fixes a memory leak in the code that handles all the HTTP redirect, a slow leak of one mac address string (18 bytes) worth of ram per request.
acv commentedon Mar 12, 2015
I'm basically going to use this Issue has a "let's audit all use of malloc and friends (safe_*) and make sure free is eventually called once and only once."
mhaas commentedon Mar 15, 2015
Gcc/clang address sanitizer might come in handy here: https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer
It's probably a bit faster than valgrind.
acv commentedon Mar 22, 2015
Further memory leak found in http.c that could leak the url for every redirects by the gateway. See PR #136
acv commentedon Mar 24, 2015
It's unclear that there are any outstanding memory leaks. It would be interesting to know if someone with a busy access point could run the latest code for a few days/weeks are report daily snapshot of the memory map to see if there's any unbounded growth.
mhaas commentedon Mar 24, 2015
I would love to see a test script which exercises wifidog. Just connect users, disconnect users etc. Probably with an authorized server which randomly sends auth: 1 and auth: 0. Then we could run valgrind.
acv commentedon Mar 24, 2015
The need for unique ip/mac pairs makes that hard to do.
7 remaining items
mhaas commentedon Mar 25, 2015
Sweet! Do you have a test framework in mind or just use exit(1) on failure?
acv commentedon Mar 25, 2015
http://check.sourceforge.net
mhaas commentedon Mar 26, 2015
Re load tests, I'll cobble together a script using macvlans: http://serverfault.com/questions/223601/multiple-mac-addresses-on-one-physical-network-interface-linux
acv commentedon Mar 26, 2015
That looks promising!
mhaas commentedon Mar 26, 2015
Yeah, it works.. almost. The vlanmac interfaces do not show up in /proc/net/arp, so I am using a custom arp table. No big problem. Almost got it working ;)
mhaas commentedon Mar 26, 2015
There you go. It's crusty, but works: https://github.com/mhaas/wifidog-gateway/tree/load-tester - in contrib/!
mhaas commentedon Mar 26, 2015
What is interesting here.. commit 6d36e51 will always log in the IP/MAC and then log it out again in 1/3 of all runs. In this settings, something seems to block inside wifidog and fire_queries.py slows down, probably because it's running into timeouts.
mhaas commentedon Mar 26, 2015
Valgrind log: http://pastebin.ca/2964645 - killed with CTRL+C
mhaas commentedon Mar 29, 2015
Heh, looks like my script got something nice:
127.0.0.1 - - [29/Mar/2015 08:55:35] code 400, message Bad request syntax ('GET /auth/?stage=counters&ip=\x88to\xb7\x88to\xb7\x10\xb4q\tx\xb5q\t(\xbcq\t(\xbcq\t\xa0to\xb7\xa0to\xb7\xa8to\xb7\xa8to\xb7\xb0to\xb7\xb0to\xb7\xb8to\xb7\xb8to\xb7\xf8\xb8q\t\xf8\xb8q\t\x80\xbdq\t\x80\xbdq\t\xe0\xbcq\tX\xb3q\t\xd8to\xb7\xd8to\xb7\xe0to\xb7\xe0to\xb7\xe8to\xb7\xe8to\xb7\xf0to\xb7\xf0to\xb7\xf8to\xb7\xf8to\xb7&mac=x\xbcq\t1:f9:5c:39:f6&token=&incoming=0&outgoing=0&gw_id=FE78B6F39D50 HTTP/1.0')
127.0.0.1 - - [29/Mar/2015 08:55:35] "GET /auth/?stage=counters&ip=�to��to���q x�q (�q (�q �to��to��to��to��to��to��to��to���q ��q ��q ��q ��qX�q �to��to��to��to��to��to��to��to��to��to�&mac=x�q 1:f9:5c:39:f6&token=&incoming=0&outgoing=0&gw_id=FE78B6F39D50 HTTP/1.0" 400
mhaas commentedon Mar 29, 2015
I can only reproduce this if I build with clang and CFLAGS="-O2 -g3", and then only sometimes. Notably, with -fno-omit-frame-pointer I only get requests running into timeouts. This looks race-condition-ish.
mhaas commentedon Mar 29, 2015
Meh, reproducing this is hard. It really only works with some flags, otherwise I apparently get a deadlock.
It seems that the client gets logged out properly on a manual requests and the client struct is deleted. In firewall.c, fw_sync_with_authserver subsequently re-uses the client and it crashes. I don't see the problem as all calls are properly locking the list.
I have now compiled with -fsanitize=address and that seems to give me some saner output.
acv commentedon Mar 29, 2015
Yep, hence why I filed #84
florida63 commentedon Mar 29, 2015
On WIFIDOG-AUTH, the logout disconnecter a client (first) on the server. It transmits info at gateway only when counter update. This creates a certain latency.
Indeed, that poses problem if the client reconnect meantime because iptables rule are doubled.
Existed commentedon Apr 11, 2015
Thanks, guys.
You're awesome. ;-)
acv commentedon Apr 14, 2015
@Existed if you're trying the new code can you report back on impact on memory usage and any issue(s) you encounter? Always eager for feedback from people with higher volume installs.