You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Jens Geyer (JIRA)" <ji...@apache.org> on 2013/11/11 23:10:18 UTC

[jira] [Comment Edited] (THRIFT-2156) TServerSocket::listen() is throwing exceptions with misleading information

    [ https://issues.apache.org/jira/browse/THRIFT-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13819485#comment-13819485 ] 

Jens Geyer edited comment on THRIFT-2156 at 11/11/13 10:08 PM:
---------------------------------------------------------------

Hi [~bmeerkoetter],

I had some problems applying the patch, it may need a rebasing. Next, I think you missed one occurrence:

{code}
    // retrieve bind info
    if (port_ == 0 && retries <= retryLimit_) {
      struct sockaddr sa;
      socklen_t len = sizeof(sa);
      std::memset(&sa, 0, len);
      if (::getsockname(serverSocket_, &sa, &len) < 0) {
        int errno_copy = errno;
        GlobalOutput.perror("TServerSocket::getPort() getsockname() ", errno_copy);
      }
      else {
         ... more code ...
{code}

IMHO the "int" before "errno_copy = errno;" should be removed here as well, otherwise the errno will be forgotten immediately after printing it into the GlobalOutput. Correct?


was (Author: jensg):
Hi [~bmeerkoetter],

I had some problems applying the patch, it may need a rebasing. Next, I think you missed one occurrence:

{code}
    // retrieve bind info
    if (port_ == 0 && retries <= retryLimit_) {
      struct sockaddr sa;
      socklen_t len = sizeof(sa);
      std::memset(&sa, 0, len);
      if (::getsockname(serverSocket_, &sa, &len) < 0) {
        int errno_copy = errno;
        GlobalOutput.perror("TServerSocket::getPort() getsockname() ", errno_copy);
      }
      else {
         ... more code ...
{code}

IMHO the {int} should be removed here as well, otherwise the errno will be forgotten immediately after printing it into the GlobalOutput.

> TServerSocket::listen() is throwing exceptions with misleading information
> --------------------------------------------------------------------------
>
>                 Key: THRIFT-2156
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2156
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.9
>            Reporter: Frank Meerkoetter
>            Priority: Minor
>         Attachments: errno_copy.patch
>
>
> Due to a problem with bind() an exception was thrown.
> The text was:
> "Could not bind: Transport endpoint is not connected"
> which doesn't make sense.
> It turned out that errno had been overwritten.
> The correct text would have been:
> "Could not bind: Address already in use"



--
This message was sent by Atlassian JIRA
(v6.1#6144)