Change-Id: I54c5edcf1a24861147868c52c7826ca32b134d6b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4352
Reviewed-by: Kumar Kaushik <kaushikk@vmware.com>
Tested-by: Kumar Kaushik <kaushikk@vmware.com>
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
Name: c-rest-engine |
| 2 | 2 |
Summary: minimal http(s) server library |
| 3 | 3 |
Version: 1.1 |
| 4 |
-Release: 3%{?dist}
|
|
| 4 |
+Release: 4%{?dist}
|
|
| 5 | 5 |
Group: Applications/System |
| 6 | 6 |
Vendor: VMware, Inc. |
| 7 | 7 |
License: Apache 2.0 |
| ... | ... |
@@ -14,6 +14,7 @@ BuildRequires: openssl-devel >= 1.0.1 |
| 14 | 14 |
Source0: %{name}-%{version}.tar.gz
|
| 15 | 15 |
Patch0: socket_RW.patch |
| 16 | 16 |
Patch1: syslog_noInit.patch |
| 17 |
+Patch2: socket_logging.patch |
|
| 17 | 18 |
%define sha1 c-rest-engine=a25927fd98ec92df5e210cc4941fa626604636f6 |
| 18 | 19 |
|
| 19 | 20 |
%description |
| ... | ... |
@@ -34,6 +35,7 @@ development libs and header files for c-rest-engine |
| 34 | 34 |
%setup -q |
| 35 | 35 |
%patch0 -p1 |
| 36 | 36 |
%patch1 -p1 |
| 37 |
+%patch2 -p1 |
|
| 37 | 38 |
|
| 38 | 39 |
%build |
| 39 | 40 |
cd build |
| ... | ... |
@@ -66,6 +68,8 @@ find %{buildroot} -name '*.la' -delete
|
| 66 | 66 |
# %doc ChangeLog README COPYING |
| 67 | 67 |
|
| 68 | 68 |
%changelog |
| 69 |
+* Mon Nov 20 2017 Kumar Kaushik <kaushikk@vmware.com> 1.1-4 |
|
| 70 |
+- Socket poller/read logging patch. |
|
| 69 | 71 |
* Fri Nov 17 2017 Kumar Kaushik <kaushikk@vmware.com> 1.1-3 |
| 70 | 72 |
- Removing syslog open/close from library. |
| 71 | 73 |
* Fri Nov 10 2017 Kumar Kaushik <kaushikk@vmware.com> 1.1-2 |
| 72 | 74 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,94 @@ |
| 0 |
+From 8afe888fb34b1d121bae7701c51d0e7d0c96cbb5 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: Kumar Kaushik <kaushikk@vmware.com> |
|
| 2 |
+Date: Mon, 20 Nov 2017 15:21:56 -0800 |
|
| 3 |
+Subject: [PATCH] Adding more debug for socket read failures |
|
| 4 |
+ |
|
| 5 |
+Change-Id: I85b10413b4fe9273a11e46da038aa2e31ffd0318 |
|
| 6 |
+(cherry picked from commit a0c4357aca99a08a28d10875aff87c6e3d1798be) |
|
| 7 |
+--- |
|
| 8 |
+ common/sockinterface.c | 11 +++++------ |
|
| 9 |
+ transport/posix/socket.c | 27 ++++++++++++++++++++++++++- |
|
| 10 |
+ 2 files changed, 31 insertions(+), 7 deletions(-) |
|
| 11 |
+ |
|
| 12 |
+diff --git a/common/sockinterface.c b/common/sockinterface.c |
|
| 13 |
+index a53c4a5..403189c 100644 |
|
| 14 |
+--- a/common/sockinterface.c |
|
| 15 |
+@@ -521,11 +521,10 @@ VmRESTTcpReceiveNewData( |
|
| 16 |
+ {
|
|
| 17 |
+ VMREST_LOG_DEBUG(pRESTHandle,"%s","Calling closed connection...."); |
|
| 18 |
+ /**** Close connection ****/ |
|
| 19 |
+- dwError = VmRESTDisconnectClient( |
|
| 20 |
+- pRESTHandle, |
|
| 21 |
+- pSocket |
|
| 22 |
+- ); |
|
| 23 |
+- BAIL_ON_VMREST_ERROR(dwError); |
|
| 24 |
++ VmRESTDisconnectClient( |
|
| 25 |
++ pRESTHandle, |
|
| 26 |
++ pSocket |
|
| 27 |
++ ); |
|
| 28 |
+ |
|
| 29 |
+ /**** free request object memory ****/ |
|
| 30 |
+ if (pRequest) |
|
| 31 |
+@@ -542,7 +541,7 @@ VmRESTTcpReceiveNewData( |
|
| 32 |
+ |
|
| 33 |
+ error: |
|
| 34 |
+ |
|
| 35 |
+- VMREST_LOG_DEBUG(pRESTHandle,"ERROR code %u", dwError); |
|
| 36 |
++ VMREST_LOG_ERROR(pRESTHandle,"ERROR code %u", dwError); |
|
| 37 |
+ goto cleanup; |
|
| 38 |
+ } |
|
| 39 |
+ |
|
| 40 |
+diff --git a/transport/posix/socket.c b/transport/posix/socket.c |
|
| 41 |
+index 029633a..79c7a38 100644 |
|
| 42 |
+--- a/transport/posix/socket.c |
|
| 43 |
+@@ -539,6 +539,8 @@ VmSockPosixWaitForEvent( |
|
| 44 |
+ BAIL_ON_VMREST_ERROR(dwError); |
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 47 |
++ VMREST_LOG_DEBUG(pRESTHandle,"Notification on socket fd %d", pEventSocket->fd); |
|
| 48 |
++ |
|
| 49 |
+ if (pEvent->events & (EPOLLERR | EPOLLHUP)) |
|
| 50 |
+ {
|
|
| 51 |
+ eventType = VM_SOCK_EVENT_TYPE_CONNECTION_CLOSED; |
|
| 52 |
+@@ -919,8 +921,23 @@ VmSockPosixRead( |
|
| 53 |
+ |
|
| 54 |
+ error: |
|
| 55 |
+ |
|
| 56 |
+- if (pszBufPrev && pSocket) |
|
| 57 |
++ if (pSocket) |
|
| 58 |
++ {
|
|
| 59 |
++ VMREST_LOG_ERROR(pRESTHandle,"Socket read failed with Socket fd %d, dwError = %u, nRead = %d, errno = %u, errorCode = %u", pSocket->fd, dwError, nRead, errno, errorCode); |
|
| 60 |
++ } |
|
| 61 |
++ else |
|
| 62 |
++ {
|
|
| 63 |
++ VMREST_LOG_ERROR(pRESTHandle,"Socket read failed with dwError = %u, nRead = %d, errno = %u, errorCode = %u", dwError, nRead, errno, errorCode); |
|
| 64 |
++ } |
|
| 65 |
++ |
|
| 66 |
++ if (pszBufPrev && pSocket && pRESTHandle->pSockContext) |
|
| 67 |
+ {
|
|
| 68 |
++ /**** Delete the socket from poller ****/ |
|
| 69 |
++ VmSockPosixEventQueueDelete_inlock( |
|
| 70 |
++ pRESTHandle->pSockContext->pEventQueue, |
|
| 71 |
++ pSocket |
|
| 72 |
++ ); |
|
| 73 |
++ |
|
| 74 |
+ VmRESTFreeMemory(pszBufPrev); |
|
| 75 |
+ pszBufPrev = NULL; |
|
| 76 |
+ pSocket->pszBuffer = NULL; |
|
| 77 |
+@@ -1542,6 +1559,14 @@ VmSockPosixSetRequestHandle( |
|
| 78 |
+ pSocket->pTimerSocket |
|
| 79 |
+ ); |
|
| 80 |
+ BAIL_ON_VMREST_ERROR(dwError); |
|
| 81 |
++ |
|
| 82 |
++ /**** Delete actual IO socket from poller ****/ |
|
| 83 |
++ dwError = VmSockPosixEventQueueDelete_inlock( |
|
| 84 |
++ pQueue, |
|
| 85 |
++ pSocket |
|
| 86 |
++ ); |
|
| 87 |
++ BAIL_ON_VMREST_ERROR(dwError); |
|
| 88 |
++ |
|
| 89 |
+ if (pSocket->pTimerSocket->fd > 0) |
|
| 90 |
+ {
|
|
| 91 |
+ close(pSocket->pTimerSocket->fd); |