Skip to content

Prevent possible leaks#169

Merged
mhaas merged 2 commits into
wifidog:masterfrom
acv:leak_httpd
Apr 1, 2015
Merged

Prevent possible leaks#169
mhaas merged 2 commits into
wifidog:masterfrom
acv:leak_httpd

Conversation

@acv

@acv acv commented Mar 29, 2015

Copy link
Copy Markdown
Contributor

In some error scenarios, HTTP request objects could not have been freed.

Prompted by valgrind results from #34

@acv

acv commented Mar 29, 2015

Copy link
Copy Markdown
Contributor Author

3 out of 4 builds in the matrix failed because Travis couldn't git pull from github due to ongoing DDoS.

@acv

acv commented Mar 29, 2015

Copy link
Copy Markdown
Contributor Author

All build passed now that Github is accessible.

@mhaas

mhaas commented Mar 29, 2015

Copy link
Copy Markdown
Contributor

Thanks. I will test tomorrow with the load tester. Now that it's not crashing anymore, I'm seeing some nice memory leaks and (possibly) hanging threads. That is, before applying this patch.

@mhaas

mhaas commented Mar 29, 2015

Copy link
Copy Markdown
Contributor

I'm running this patch and your refactor patch and the load tester is behaving a bit weird... it seems that one of the HTTP call raises an exception. When I print it, I only get the empty string ''. Of course, the request does not seem to fire. I will investigate further tomorrow.

Comment thread src/gateway.c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have a DEBUG log here? Or is an interrupted system call something that happens regularly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should happen a lot when a gateway is not in use.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think so. The timeout argument to select is NULL:

If timeout is NULL (no time‐out), select() can block indefinitely.

The load tester runs fine until, at some point, I am seeing a lot of bad (empty) HTTP status lines which possibly come from somewhere in that code path. I added a debug print and the bad status lines and webServr->lastError == -1 do coincide.

@mhaas

mhaas commented Apr 1, 2015

Copy link
Copy Markdown
Contributor

Ah, I think the problem happens because server->lastError is never reset. This way, the code always takes the error handling path even if the request was actually succesfull.

mhaas added a commit that referenced this pull request Apr 1, 2015
@mhaas mhaas merged commit d2492f5 into wifidog:master Apr 1, 2015
@acv acv deleted the leak_httpd branch April 1, 2015 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants