You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Pieter Maes (JIRA)" <ji...@apache.org> on 2010/08/17 23:44:20 UTC

[jira] Commented: (THRIFT-826) PHP TSocket Write Timeout

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

Pieter Maes commented on THRIFT-826:
------------------------------------

I have an simmular issue
what i have found is (when using the php thift module)
since the fix of directWrite in /ext/thrift_protocol/php_thrift_protocol.cpp
----------
 void directWrite(const char* data, size_t len) { 
    zval writefn; 
    ZVAL_STRING(&writefn, "write", 0); 
    --char* newbuf = (char*)emalloc(buffer_used + 1); 
    --memcpy(newbuf, buffer, buffer_used); 
    --newbuf[buffer_used] = '\0'; 
    ++char* newbuf = (char*)emalloc(len + 1); 
    ++memcpy(newbuf, data, len); 
    ++newbuf[len] = '\0'; 
    zval *args[1]; 
    MAKE_STD_ZVAL(args[0]); 
    --ZVAL_STRINGL(args[0], newbuf, buffer_used, 0); 
    ++ZVAL_STRINGL(args[0], newbuf, len, 0); 
    TSRMLS_FETCH(); 
    zval ret; 
----------
since this was in place, the write fails
i guess it is called by with the wrong paramaters somewhere?
so if you undo this (set len to buffer_used and data to buffer)
it works

> PHP TSocket Write Timeout
> -------------------------
>
>                 Key: THRIFT-826
>                 URL: https://issues.apache.org/jira/browse/THRIFT-826
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (PHP)
>    Affects Versions: 0.2
>         Environment: Fedora 8, 64bit, php 5.2.4 
>            Reporter: Loreto Parisi
>             Fix For: 0.5
>
>
> TException: TSocket: Could not write 48 bytes localhost:9160
> The error comes out often from TSocket#write($buf), row 279 at line 292:
>     while (strlen($buf) > 0) {
>       $got = @fwrite($this->handle_, $buf);
>       if ($got === 0 || $got === FALSE) {
>         $md = stream_get_meta_data($this->handle_);
>         if ($md['timed_out']) {
>           throw new TException('TSocket: timed out writing '.strlen($buf).' bytes from '.
>                                $this->host_.':'.$this->port_);
>         } else {
>             // HERE
>             throw new TException('TSocket: Could not write '.strlen($buf).' bytes '.
>                                  $this->host_.':'.$this->port_);
>         }
>       }
>       $buf = substr($buf, $got);
>     }
> I found a similar issue in reading TSocket, described here: https://issues.apache.org/jira/browse/THRIFT-347

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.