-
Notifications
You must be signed in to change notification settings - Fork 207
Bugfix for Socket lifetime issues #571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix for Socket lifetime issues #571
Conversation
…ets causing DataAbort interrupts. (FreeRTOS#570)
c577157 to
72c72b2
Compare
72c72b2 to
a30bd2d
Compare
|
Note - I've fixed up the existing unit-tests to pass with all of the changes. So the original code paths are all passing 100%, but there are new code paths. The ci unit-tests are currently failing because there is an expectation that the code-coverage is 100%. Please feel free to assign someone else to perform the task of increasing the code coverage to 100% by adding new test cases to cover the new code paths. Note: the unit-test methodology that has been used for this project means the developer must write the code multiple times. Once for the actual code, and then another time for each and every execution path that is there (eg. per test). I'd suggest looking into other test frameworks such as googletest which could provide much better abstraction layers and provide test frameworks where setting-up and tearing-down tests is performed by a test-framework so that the test suite can be partitioned and each test is only the things that are actually being tested (and not all the bring-up and tear-down operations). This would also allow private C functions to be tested in the environment that they are being used, and not require independent tests per private function. I am all for unit-tests, code-coverage and advancing this further with static analysis runs on the unit tests; however, the technical methodology is putting an undue burden on the developer to change too much test code every time a change occurs. |
…the new code paths.
Hello @moninom1 and @shubnil I won't be getting to this any time soon. The customer that I provided the fix for in my original fork of this repo is fine with the current change described in this PR and has another contractor maintaining the code at this point. So there is no incentive for me to revisit this in the short term. If the customer comes back with a request to upgrade to a newer version of FreeRTOS+TCP then I will most likely suggest doing this check at that time. You have closed the aforementioned bug #570 with a different fix to this one (#707). I am assuming you have in place a unit test that tests the specific use case outlined in : #570 (comment) and confirms that it passes when that particular use case occurs? If you have confirmation that the above use case failed before that change and now passes, then feel free to close; otherwise, please leave open until the customer decides to no longer use this fork and either upgrade to a newer version of FreeRTOS+TCP or use a different network stack. Thanks |
|
Hi @phelter, Thanks |
Bugfix for Socket lifetime issues
Have confirmed that this fix solves the issue originally reported in (#570)
Description
Added a new option to
vSocketCloseto select whether to destroy the socket at the end of close.bDestroyvSocketClose:bDestroy = true.bDestroy = false.Keep track of the lifetime of all sockets in 2 lists inside the FreeRTOS_Sockets.c file:
xActiveSocketsListandxInactiveSocketsList.Also check internally that the data arriving from events to the
IPTaskare valid and correct. -socketASSERT_IS_VALID().Check internally that only
vSocketClosecan be performed on a socket that hasn't been destroyed, and all other events/actions can only be performed onactive socketsTest Steps
See Related issue.
Confirmed that previous flow of multiple closes (by internal and user) are now handled properly: Log file of working solution:
Related Issue
See Issue (#570)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.