Skip to content
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

Fix epoll and socket resource leak issue. #651

Merged
merged 2 commits into from
Jul 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pyext/swsscommon.i
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ T castSelectableObj(swss::Selectable *temp)
%template(hgetall) hgetall<std::map<std::string, std::string>>;
}

%extend swss::PubSub {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

WIll delete this code.
Also will check if other method need decorate with %newobject

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, these 2 methods are all methods return new object in sonic-swss-common.

%pythoncode {
def __del__(self):
self.__swig_destroy__(self.this)
del self.this
}
}

%ignore swss::TableEntryPoppable::pops(std::deque<KeyOpFieldsValuesTuple> &, const std::string &);
%apply std::vector<std::string>& OUTPUT {std::vector<std::string> &keys};
%apply std::vector<std::string>& OUTPUT {std::vector<std::string> &ops};
Expand Down Expand Up @@ -210,3 +218,7 @@ T castSelectableObj(swss::Selectable *temp)
%include "dbinterface.h"
%include "logger.h"
%include "status_code_util.h"

// Handle object ownership issue with %newobject https://www.swig.org/Doc4.0/SWIGDocumentation.html#Customization_ownership
%newobject DBConnector::pubsub();
%newobject DBConnector::newConnector(unsigned int timeout);