| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
How to analyze error messages |
| 4 |
============================= |
| 5 |
|
| 6 |
This section describes how to analyze Groonga error messages. |
| 7 |
|
| 8 |
|
| 9 |
How to analyze socket errors |
| 10 |
---------------------------- |
| 11 |
|
| 12 |
This subsection describes how to analyze socket errors with an example. |
| 13 |
|
| 14 |
|
| 15 |
Example |
| 16 |
^^^^^^^ |
| 17 |
|
| 18 |
The following is an example of an error message reported by Groonga, where xxxxx is an arbitrary number:: |
| 19 |
|
| 20 |
socket error[xxxxx]: no buffer: accept |
| 21 |
|
| 22 |
|
| 23 |
How to analyze |
| 24 |
^^^^^^^^^^^^^^ |
| 25 |
|
| 26 |
First, grep Groonga source files for "SOERR" that is the name of a macro for socket errors. |
| 27 |
|
| 28 |
Then, extract SOERRs whose argument contains "accept" from the grep output and you will find the following SOERRs:: |
| 29 |
|
| 30 |
lib/com.c: SOERR("listen - start accept"); |
| 31 |
lib/com.c: SOERR("listen - disable accept"); |
| 32 |
lib/com.c: SOERR("accept"); |
| 33 |
|
| 34 |
It is clear that the above error message is associated with the last line because the error message contains only "accept". |
| 35 |
|
| 36 |
The source code around the line is as follows:: |
| 37 |
|
| 38 |
grn_sock fd = accept(com->fd, NULL, NULL); |
| 39 |
if (fd == -1) { |
| 40 |
if (errno == EMFILE) { |
| 41 |
grn_com_event_stop_accept(ctx, ev); |
| 42 |
} else { |
| 43 |
SOERR("accept"); |
| 44 |
} |
| 45 |
return; |
| 46 |
} |
| 47 |
|
| 48 |
From the above source code, you can confirm that the error occurred due to accept. |
| 49 |
Let's dig into the cause. |
| 50 |
|
| 51 |
The error message provides hints for investigation:: |
| 52 |
|
| 53 |
[10055]: no buffer |
| 54 |
|
| 55 |
10055 is a Windows socket error code and "no buffer" is a message by Groonga given in SOERR. |
| 56 |
|
| 57 |
Windows socket error codes are listed in the following page:: |
| 58 |
|
| 59 |
https://msdn.microsoft.com/ja-jp/library/windows/desktop/ms740668(v=vs.85).aspx |
| 60 |
|
| 61 |
10055 is assigned to WSAENOBUFS and its description is as follows:: |
| 62 |
|
| 63 |
No buffer space available. |
| 64 |
|
| 65 |
An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full. |
| 66 |
|
| 67 |
From the above description, you can narrow down the causes. |
| 68 |
The possible causes are the lack of memory and too many connections. |
| 69 |
Finally, determine which one is appropriate for the situation when the error occurred. |