Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 10 additions & 5 deletions doc/pol.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ Parameter | Meaning
----------| -------
-g | Specifies a "grep" string that is used to filter the output. You can specify any valid Perl regex for grep-string (see example below).

> Note that the log file must contain naming messages (`log_level_naming` in mama.properties) to get the process's name and PID.
The output of the command is in tab-separated format, and can easily be imported into most spreadsheet programs.

### Notes

1. The log file must contain naming messages (`log_level_naming` in mama.properties) to get the process's name and PID.
2. Only the first CONNECT REQ from a particular endpoint is displayed -- subsequent CONNECT REQ messages are discarded.

## Example

Expand All @@ -30,7 +35,7 @@ Time | Event | Host | Port | Prog | PID | fd
6/13 16:07:13.207611|CONNECT REQ|nsb12|43814|tpsdaemon|12334|0
6/13 16:07:13.209573|CONNECTED|nsb12|39195|tpsdaemon|18893|52
6/13 16:07:13.209682|CONNECTED|nsb11|36375|tpsdaemon|16384|51
6/13 16:07:13.209904|CONNECTED|nsb12|43814|tpsdaemon|12334|55
6/13 16:07:13.210329|CONNECT REQ|nsb13|38855|tpsworker|7412|0
6/13 16:07:13.210723|CONNECT REQ|nsb12|33745|tpsdaemon|7679|0
6/13 16:07:13.210904|CONNECT REQ|nsb13|44681|tpsworker|7576|0
6/13 16:07:13.232949|HANDSHAKE_SUCCEEDED|nsb11|43735|tpsworker|16623|81
6/13 16:07:13.233025|HANDSHAKE_SUCCEEDED|nsb11|42554|tpsworker|16884|97
6/13 16:07:13.233087|HANDSHAKE_SUCCEEDED|nsb11|37988|tpsworker|20351|93
6/13 16:07:13.236395|HANDSHAKE_SUCCEEDED|nsb11|36375|tpsdaemon|16384|51
4 changes: 4 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ install(TARGETS timer DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
add_executable(timer2 timer2.cpp)
target_link_libraries(timer2 ozimpl mama)
install(TARGETS timer2 DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})

add_executable(leak leak.cpp)
target_link_libraries(leak ozimpl mama)
install(TARGETS leak DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
43 changes: 43 additions & 0 deletions examples/leak.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// just to verify that asan/lsan are working properly

#include <string>
#include <cstdio>
using namespace std;

#include <mama/mama.h>

#include "ozimpl.h"
using namespace oz;

class myTimerEvents : public timerEvents
{
virtual void MAMACALLTYPE onTimer() override
{
static int i = 0;
fprintf(stderr, "timer=%d\n", ++i);
}
};


int main(int argc, char** argv)
{
cmdLine cli(argc, argv);

auto conn = createConnection(cli.getMw(), cli.getPayload(), cli.getTportSub());
TRY_MAMA_FUNC(conn->start());

auto sess = conn->createSession();
TRY_MAMA_FUNC(sess->start());

myTimerEvents timerEvents;
auto pTimer = sess->createTimer(0.5, &timerEvents).release();
TRY_MAMA_FUNC(pTimer->start());

sleep(5);

pTimer->destroy();

void* leak = malloc(512);

return 0;
}
3 changes: 2 additions & 1 deletion src/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ zmqBridge_close(mamaBridge bridgeImpl)
/* The timer thread expects us to be responsible for terminating it */
wthread_join(timerThread, NULL);
}
mamaBridgeImpl_setClosure(bridgeImpl, NULL);
mamaBridgeImpl_setClosure(bridgeImpl, NULL);
free(closure);

Choose a reason for hiding this comment

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

Is this part of the error message changes or something separate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a fix made in early June that has not been merged into master, which is why it's showing up here.


/* Destroy once queue has been emptied */
mama_getDefaultEventQueue(bridgeImpl, &defaultEventQueue);
Expand Down
8 changes: 7 additions & 1 deletion src/subscription.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,16 @@ mama_status zmqBridgeMamaSubscription_createWildCard(subscriptionBridge* subscri
if (prefix[0] == '^') {
++prefix; // skip beginning anchor
}
char* regexPos = strpbrk(prefix, "[^/]+.*"); // find wildcard regex?
char* regexPos = strstr(prefix, "[^/]+"); // find wildcard regex?
if (regexPos != NULL) {
*regexPos = '\0'; // overwrite with null
}
else {
int l = strlen(prefix);
if (strcmp(&prefix[l-3], "/.*") == 0) { // find trailing "super" wildcard?
prefix[l-2] = '\0'; // overwrite with null
}
}
MAMA_LOG(MAMA_LOG_LEVEL_FINE, "source=%s,prefix=%s", source, prefix);

// create regex to match against
Expand Down
6 changes: 3 additions & 3 deletions src/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ mama_status zmqBridgeMamaTransportImpl_dispatchNamingMsg(zmqTransportBridge* imp
wlock_unlock(impl->mZmqDataPub.mLock);
#endif

MAMA_LOG(MAMA_LOG_LEVEL_NORMAL, "Disconnecting data sockets from publisher:%s", pMsg->mEndPointAddr);
MAMA_LOG(MAMA_LOG_LEVEL_NORMAL, "Disconnected data sockets from publisher:%s", pMsg->mEndPointAddr);
}
else if (pMsg->mType == 'W') {
// welcome msg - naming subscriber is connected
Expand Down Expand Up @@ -1005,7 +1005,7 @@ void MAMACALLTYPE zmqBridgeMamaTransportImpl_wcCallback(mamaQueue queue, void*
findClosure.mSubscription = NULL;
list_for_each(tmsg->mTransport->mWcEndpoints, (wListCallback) zmqBridgeMamaTransportImpl_findWildcard, &findClosure);
if (findClosure.mSubscription == NULL) {
MAMA_LOG(MAMA_LOG_LEVEL_ERROR, "No endpoint found for topic %s with id %s", subject, tmsg->mEndpointIdentifier);
MAMA_LOG(MAMA_LOG_LEVEL_WARN, "No endpoint found for topic %s with id %s", subject, tmsg->mEndpointIdentifier);
goto exit;
}

Expand Down Expand Up @@ -1205,7 +1205,7 @@ mama_status zmqBridgeMamaTransportImpl_disconnectSocket(zmqSocket* socket, const

int rc = zmq_disconnect(socket->mSocket, uri);
if (0 != rc) {
MAMA_LOG(MAMA_LOG_LEVEL_ERROR, "zmq_disconnect(%p, %s) failed: %d(%s)", socket->mSocket, uri, zmq_errno(), zmq_strerror(errno));
MAMA_LOG(MAMA_LOG_LEVEL_WARN, "zmq_disconnect(%p, %s) failed: %d(%s)", socket->mSocket, uri, zmq_errno(), zmq_strerror(errno));
status = MAMA_STATUS_PLATFORM;
}

Expand Down