You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Francisco Byun <co...@gmail.com> on 2010/05/17 20:49:04 UTC

"TSocket read 0 bytes" when dictionary contains unicode character on 64-bit Ubuntu

Hello. I'm running a BBS written in Python which use Thrift as the
protocol between Backend & Frontend server. Recently I tried to
migrate Frontend server. Former Frontend server was 32-bit Ubuntu
server. New Frontend server is 64-bit Ubuntu server with doubled
memory.

But I failed.

When Frontend ask Backend to send some information, it works fine. But
when Frontend tries to send some information, it does not work very
well. For example, I tried to write an article written in English,
everything was fine. But when I tried to write an article written in
Korean, it just screwed up with following traceback.

What should I inspect? Is this reported Thrift problem, or my code is
wrong? (But identical source works fine with 32-bit Ubuntu server

.)

Traceback (most recent call last):

 File "/usr/local/lib/python2.6/dist-packages/Django-1.2-py2.6.egg/django/core/handlers/base.py",
line 100, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/home/ara/arara/warara/__init__.py", line 24, in check_error
   return f(*args, **argv)

 File "/home/ara/arara/warara/board/views.py", line 118, in write
   return write_(request, board_name)

 File "/home/ara/arara/warara/__init__.py", line 24, in check_error
   return f(*args, **argv)

 File "/home/ara/arara/warara/board/views.py", line 169, in write_
   article_id = server.article_manager.write_article(sess, board_name,
WrittenArticle(**article_dic))

 File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
607, in write_article
   return self.recv_write_article()

 File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
620, in recv_write_article
   (fname, mtype, rseqid) = self._iprot.readMessageBegin()

 File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
line 126, in readMessageBegin
   sz = self.readI32()

 File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
line 203, in readI32
   buff = self.trans.readAll(4)

 File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
line 58, in readAll
   chunk = self.read(sz-have)

 File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
line 155, in read
   self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))

 File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TSocket.py",
line 94, in read
   raise TTransportException(type=TTransportException.END_OF_FILE,
message='TSocket read 0 bytes')

TTransportException: TSocket read 0 bytes

<ModPythonRequest
path:/board/test/write/,
GET:<QueryDict: {}>,
POST:<QueryDict: {u'file1': [u'', u''], u'delete_file': [u''],
u'article_no': [u''], u'title': [u'test'], u'text': [u'--\r\nKAIST
\ucca0\ud559\uacfc\uc5d0 \uc7ac\ud559\uc911\uc778
\ubcc0\uaddc\ud64d\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4.'],
u'article_write': [u'write'], u'board_name': [u'test'], u'write_type':
[u'write'], u'file1_fi': [u'', u'']}>,

Re: "TSocket read 0 bytes" when dictionary contains unicode character on 64-bit Ubuntu

Posted by Francisco Byun <co...@gmail.com>.
When I'm using Thrift alone, no problem occur. But when I'm using it
through mod_python extension with Apache2 web server, the problem
occurs. ... Now I'm totally confused about this issue ...

2010/5/19 Francisco Byun <co...@gmail.com>:
> Hello David,
>
> When I'm testing with Ubuntu 32-bit version installed in "SAME" server
> (I mean, same hardware), no problem occurs. Problem only occurs when
> I'm using Ubuntu 64-bit version. I'm trying to write down a code which
> is short and simple enough to report & reproduce this problem. Would
> this be helpful to find out the exact problematic point?
>
> @ Maybe I should use 32-bit server for now ...
>
> 2010/5/18 David Reiss <dr...@facebook.com>:
>> I'm not really sure what would cause this.  It sounds like either
>> a bug in the fastbinary module or corrupted data being sent to the
>> server.
>>
>> --David
>>
>> Francisco Byun wrote:
>>> Hello David,
>>>
>>> I forgot to take a look at server error log. This is what I found from
>>> server. Well, server think, it got "Unexpected TType". Again, it only
>>> happens when I put non-latin character (Korean letters) in the string.
>>> If I send everything purely in latin character, no ERROR occurs.
>>>
>>> 2010-05-18 03:37:57,917 [25831:-4E200470] <root> ** ERROR ** Unexpected TType
>>> Traceback (most recent call last):
>>>   File "build/bdist.linux-i686/egg/thrift/server/TServer.py", line
>>> 157, in serveClient
>>>     self.processor.process(iprot, oprot)
>>>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>> 833, in process
>>>     self._processMap[name](self, seqid, iprot, oprot)
>>>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>> 1036, in process_write_article
>>>     args.read(iprot)
>>>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>> 3054, in read
>>>     fastbinary.decode_binary(self, iprot.trans, (self.__class__,
>>> self.thrift_spec))
>>> TypeError: Unexpected TType
>>>
>>>
>>> 2010/5/18 David Reiss <dr...@facebook.com>:
>>>> It looks like the server closed the connection without sending back
>>>> a response.  I would take a look at the server error log.
>>>>
>>>> --David
>>>>
>>>> Francisco Byun wrote:
>>>>> Hello. I'm running a BBS written in Python which use Thrift as the
>>>>> protocol between Backend & Frontend server. Recently I tried to
>>>>> migrate Frontend server. Former Frontend server was 32-bit Ubuntu
>>>>> server. New Frontend server is 64-bit Ubuntu server with doubled
>>>>> memory.
>>>>>
>>>>> But I failed.
>>>>>
>>>>> When Frontend ask Backend to send some information, it works fine. But
>>>>> when Frontend tries to send some information, it does not work very
>>>>> well. For example, I tried to write an article written in English,
>>>>> everything was fine. But when I tried to write an article written in
>>>>> Korean, it just screwed up with following traceback.
>>>>>
>>>>> What should I inspect? Is this reported Thrift problem, or my code is
>>>>> wrong? (But identical source works fine with 32-bit Ubuntu server
>>>>>
>>>>> .)
>>>>>
>>>>> Traceback (most recent call last):
>>>>>
>>>>>  File "/usr/local/lib/python2.6/dist-packages/Django-1.2-py2.6.egg/django/core/handlers/base.py",
>>>>> line 100, in get_response
>>>>>    response = callback(request, *callback_args, **callback_kwargs)
>>>>>
>>>>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>>>>    return f(*args, **argv)
>>>>>
>>>>>  File "/home/ara/arara/warara/board/views.py", line 118, in write
>>>>>    return write_(request, board_name)
>>>>>
>>>>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>>>>    return f(*args, **argv)
>>>>>
>>>>>  File "/home/ara/arara/warara/board/views.py", line 169, in write_
>>>>>    article_id = server.article_manager.write_article(sess, board_name,
>>>>> WrittenArticle(**article_dic))
>>>>>
>>>>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>>>> 607, in write_article
>>>>>    return self.recv_write_article()
>>>>>
>>>>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>>>> 620, in recv_write_article
>>>>>    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
>>>>>
>>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>>>>> line 126, in readMessageBegin
>>>>>    sz = self.readI32()
>>>>>
>>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>>>>> line 203, in readI32
>>>>>    buff = self.trans.readAll(4)
>>>>>
>>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>>>>> line 58, in readAll
>>>>>    chunk = self.read(sz-have)
>>>>>
>>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>>>>> line 155, in read
>>>>>    self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))
>>>>>
>>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TSocket.py",
>>>>> line 94, in read
>>>>>    raise TTransportException(type=TTransportException.END_OF_FILE,
>>>>> message='TSocket read 0 bytes')
>>>>>
>>>>> TTransportException: TSocket read 0 bytes
>>>>>
>>>>> <ModPythonRequest
>>>>> path:/board/test/write/,
>>>>> GET:<QueryDict: {}>,
>>>>> POST:<QueryDict: {u'file1': [u'', u''], u'delete_file': [u''],
>>>>> u'article_no': [u''], u'title': [u'test'], u'text': [u'--\r\nKAIST
>>>>> \ucca0\ud559\uacfc\uc5d0 \uc7ac\ud559\uc911\uc778
>>>>> \ubcc0\uaddc\ud64d\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4.'],
>>>>> u'article_write': [u'write'], u'board_name': [u'test'], u'write_type':
>>>>> [u'write'], u'file1_fi': [u'', u'']}>,
>>
>

Re: "TSocket read 0 bytes" when dictionary contains unicode character on 64-bit Ubuntu

Posted by Francisco Byun <co...@gmail.com>.
Hello David,

When I'm testing with Ubuntu 32-bit version installed in "SAME" server
(I mean, same hardware), no problem occurs. Problem only occurs when
I'm using Ubuntu 64-bit version. I'm trying to write down a code which
is short and simple enough to report & reproduce this problem. Would
this be helpful to find out the exact problematic point?

@ Maybe I should use 32-bit server for now ...

2010/5/18 David Reiss <dr...@facebook.com>:
> I'm not really sure what would cause this.  It sounds like either
> a bug in the fastbinary module or corrupted data being sent to the
> server.
>
> --David
>
> Francisco Byun wrote:
>> Hello David,
>>
>> I forgot to take a look at server error log. This is what I found from
>> server. Well, server think, it got "Unexpected TType". Again, it only
>> happens when I put non-latin character (Korean letters) in the string.
>> If I send everything purely in latin character, no ERROR occurs.
>>
>> 2010-05-18 03:37:57,917 [25831:-4E200470] <root> ** ERROR ** Unexpected TType
>> Traceback (most recent call last):
>>   File "build/bdist.linux-i686/egg/thrift/server/TServer.py", line
>> 157, in serveClient
>>     self.processor.process(iprot, oprot)
>>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>> 833, in process
>>     self._processMap[name](self, seqid, iprot, oprot)
>>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>> 1036, in process_write_article
>>     args.read(iprot)
>>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>> 3054, in read
>>     fastbinary.decode_binary(self, iprot.trans, (self.__class__,
>> self.thrift_spec))
>> TypeError: Unexpected TType
>>
>>
>> 2010/5/18 David Reiss <dr...@facebook.com>:
>>> It looks like the server closed the connection without sending back
>>> a response.  I would take a look at the server error log.
>>>
>>> --David
>>>
>>> Francisco Byun wrote:
>>>> Hello. I'm running a BBS written in Python which use Thrift as the
>>>> protocol between Backend & Frontend server. Recently I tried to
>>>> migrate Frontend server. Former Frontend server was 32-bit Ubuntu
>>>> server. New Frontend server is 64-bit Ubuntu server with doubled
>>>> memory.
>>>>
>>>> But I failed.
>>>>
>>>> When Frontend ask Backend to send some information, it works fine. But
>>>> when Frontend tries to send some information, it does not work very
>>>> well. For example, I tried to write an article written in English,
>>>> everything was fine. But when I tried to write an article written in
>>>> Korean, it just screwed up with following traceback.
>>>>
>>>> What should I inspect? Is this reported Thrift problem, or my code is
>>>> wrong? (But identical source works fine with 32-bit Ubuntu server
>>>>
>>>> .)
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>  File "/usr/local/lib/python2.6/dist-packages/Django-1.2-py2.6.egg/django/core/handlers/base.py",
>>>> line 100, in get_response
>>>>    response = callback(request, *callback_args, **callback_kwargs)
>>>>
>>>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>>>    return f(*args, **argv)
>>>>
>>>>  File "/home/ara/arara/warara/board/views.py", line 118, in write
>>>>    return write_(request, board_name)
>>>>
>>>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>>>    return f(*args, **argv)
>>>>
>>>>  File "/home/ara/arara/warara/board/views.py", line 169, in write_
>>>>    article_id = server.article_manager.write_article(sess, board_name,
>>>> WrittenArticle(**article_dic))
>>>>
>>>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>>> 607, in write_article
>>>>    return self.recv_write_article()
>>>>
>>>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>>> 620, in recv_write_article
>>>>    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
>>>>
>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>>>> line 126, in readMessageBegin
>>>>    sz = self.readI32()
>>>>
>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>>>> line 203, in readI32
>>>>    buff = self.trans.readAll(4)
>>>>
>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>>>> line 58, in readAll
>>>>    chunk = self.read(sz-have)
>>>>
>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>>>> line 155, in read
>>>>    self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))
>>>>
>>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TSocket.py",
>>>> line 94, in read
>>>>    raise TTransportException(type=TTransportException.END_OF_FILE,
>>>> message='TSocket read 0 bytes')
>>>>
>>>> TTransportException: TSocket read 0 bytes
>>>>
>>>> <ModPythonRequest
>>>> path:/board/test/write/,
>>>> GET:<QueryDict: {}>,
>>>> POST:<QueryDict: {u'file1': [u'', u''], u'delete_file': [u''],
>>>> u'article_no': [u''], u'title': [u'test'], u'text': [u'--\r\nKAIST
>>>> \ucca0\ud559\uacfc\uc5d0 \uc7ac\ud559\uc911\uc778
>>>> \ubcc0\uaddc\ud64d\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4.'],
>>>> u'article_write': [u'write'], u'board_name': [u'test'], u'write_type':
>>>> [u'write'], u'file1_fi': [u'', u'']}>,
>

Re: "TSocket read 0 bytes" when dictionary contains unicode character on 64-bit Ubuntu

Posted by David Reiss <dr...@facebook.com>.
I'm not really sure what would cause this.  It sounds like either
a bug in the fastbinary module or corrupted data being sent to the
server.

--David

Francisco Byun wrote:
> Hello David,
> 
> I forgot to take a look at server error log. This is what I found from
> server. Well, server think, it got "Unexpected TType". Again, it only
> happens when I put non-latin character (Korean letters) in the string.
> If I send everything purely in latin character, no ERROR occurs.
> 
> 2010-05-18 03:37:57,917 [25831:-4E200470] <root> ** ERROR ** Unexpected TType
> Traceback (most recent call last):
>   File "build/bdist.linux-i686/egg/thrift/server/TServer.py", line
> 157, in serveClient
>     self.processor.process(iprot, oprot)
>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
> 833, in process
>     self._processMap[name](self, seqid, iprot, oprot)
>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
> 1036, in process_write_article
>     args.read(iprot)
>   File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
> 3054, in read
>     fastbinary.decode_binary(self, iprot.trans, (self.__class__,
> self.thrift_spec))
> TypeError: Unexpected TType
> 
> 
> 2010/5/18 David Reiss <dr...@facebook.com>:
>> It looks like the server closed the connection without sending back
>> a response.  I would take a look at the server error log.
>>
>> --David
>>
>> Francisco Byun wrote:
>>> Hello. I'm running a BBS written in Python which use Thrift as the
>>> protocol between Backend & Frontend server. Recently I tried to
>>> migrate Frontend server. Former Frontend server was 32-bit Ubuntu
>>> server. New Frontend server is 64-bit Ubuntu server with doubled
>>> memory.
>>>
>>> But I failed.
>>>
>>> When Frontend ask Backend to send some information, it works fine. But
>>> when Frontend tries to send some information, it does not work very
>>> well. For example, I tried to write an article written in English,
>>> everything was fine. But when I tried to write an article written in
>>> Korean, it just screwed up with following traceback.
>>>
>>> What should I inspect? Is this reported Thrift problem, or my code is
>>> wrong? (But identical source works fine with 32-bit Ubuntu server
>>>
>>> .)
>>>
>>> Traceback (most recent call last):
>>>
>>>  File "/usr/local/lib/python2.6/dist-packages/Django-1.2-py2.6.egg/django/core/handlers/base.py",
>>> line 100, in get_response
>>>    response = callback(request, *callback_args, **callback_kwargs)
>>>
>>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>>    return f(*args, **argv)
>>>
>>>  File "/home/ara/arara/warara/board/views.py", line 118, in write
>>>    return write_(request, board_name)
>>>
>>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>>    return f(*args, **argv)
>>>
>>>  File "/home/ara/arara/warara/board/views.py", line 169, in write_
>>>    article_id = server.article_manager.write_article(sess, board_name,
>>> WrittenArticle(**article_dic))
>>>
>>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>> 607, in write_article
>>>    return self.recv_write_article()
>>>
>>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>>> 620, in recv_write_article
>>>    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
>>>
>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>>> line 126, in readMessageBegin
>>>    sz = self.readI32()
>>>
>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>>> line 203, in readI32
>>>    buff = self.trans.readAll(4)
>>>
>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>>> line 58, in readAll
>>>    chunk = self.read(sz-have)
>>>
>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>>> line 155, in read
>>>    self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))
>>>
>>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TSocket.py",
>>> line 94, in read
>>>    raise TTransportException(type=TTransportException.END_OF_FILE,
>>> message='TSocket read 0 bytes')
>>>
>>> TTransportException: TSocket read 0 bytes
>>>
>>> <ModPythonRequest
>>> path:/board/test/write/,
>>> GET:<QueryDict: {}>,
>>> POST:<QueryDict: {u'file1': [u'', u''], u'delete_file': [u''],
>>> u'article_no': [u''], u'title': [u'test'], u'text': [u'--\r\nKAIST
>>> \ucca0\ud559\uacfc\uc5d0 \uc7ac\ud559\uc911\uc778
>>> \ubcc0\uaddc\ud64d\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4.'],
>>> u'article_write': [u'write'], u'board_name': [u'test'], u'write_type':
>>> [u'write'], u'file1_fi': [u'', u'']}>,

Re: "TSocket read 0 bytes" when dictionary contains unicode character on 64-bit Ubuntu

Posted by Francisco Byun <co...@gmail.com>.
Hello David,

I forgot to take a look at server error log. This is what I found from
server. Well, server think, it got "Unexpected TType". Again, it only
happens when I put non-latin character (Korean letters) in the string.
If I send everything purely in latin character, no ERROR occurs.

2010-05-18 03:37:57,917 [25831:-4E200470] <root> ** ERROR ** Unexpected TType
Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/thrift/server/TServer.py", line
157, in serveClient
    self.processor.process(iprot, oprot)
  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
833, in process
    self._processMap[name](self, seqid, iprot, oprot)
  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
1036, in process_write_article
    args.read(iprot)
  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
3054, in read
    fastbinary.decode_binary(self, iprot.trans, (self.__class__,
self.thrift_spec))
TypeError: Unexpected TType


2010/5/18 David Reiss <dr...@facebook.com>:
> It looks like the server closed the connection without sending back
> a response.  I would take a look at the server error log.
>
> --David
>
> Francisco Byun wrote:
>> Hello. I'm running a BBS written in Python which use Thrift as the
>> protocol between Backend & Frontend server. Recently I tried to
>> migrate Frontend server. Former Frontend server was 32-bit Ubuntu
>> server. New Frontend server is 64-bit Ubuntu server with doubled
>> memory.
>>
>> But I failed.
>>
>> When Frontend ask Backend to send some information, it works fine. But
>> when Frontend tries to send some information, it does not work very
>> well. For example, I tried to write an article written in English,
>> everything was fine. But when I tried to write an article written in
>> Korean, it just screwed up with following traceback.
>>
>> What should I inspect? Is this reported Thrift problem, or my code is
>> wrong? (But identical source works fine with 32-bit Ubuntu server
>>
>> .)
>>
>> Traceback (most recent call last):
>>
>>  File "/usr/local/lib/python2.6/dist-packages/Django-1.2-py2.6.egg/django/core/handlers/base.py",
>> line 100, in get_response
>>    response = callback(request, *callback_args, **callback_kwargs)
>>
>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>    return f(*args, **argv)
>>
>>  File "/home/ara/arara/warara/board/views.py", line 118, in write
>>    return write_(request, board_name)
>>
>>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>>    return f(*args, **argv)
>>
>>  File "/home/ara/arara/warara/board/views.py", line 169, in write_
>>    article_id = server.article_manager.write_article(sess, board_name,
>> WrittenArticle(**article_dic))
>>
>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>> 607, in write_article
>>    return self.recv_write_article()
>>
>>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
>> 620, in recv_write_article
>>    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
>>
>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>> line 126, in readMessageBegin
>>    sz = self.readI32()
>>
>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
>> line 203, in readI32
>>    buff = self.trans.readAll(4)
>>
>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>> line 58, in readAll
>>    chunk = self.read(sz-have)
>>
>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
>> line 155, in read
>>    self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))
>>
>>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TSocket.py",
>> line 94, in read
>>    raise TTransportException(type=TTransportException.END_OF_FILE,
>> message='TSocket read 0 bytes')
>>
>> TTransportException: TSocket read 0 bytes
>>
>> <ModPythonRequest
>> path:/board/test/write/,
>> GET:<QueryDict: {}>,
>> POST:<QueryDict: {u'file1': [u'', u''], u'delete_file': [u''],
>> u'article_no': [u''], u'title': [u'test'], u'text': [u'--\r\nKAIST
>> \ucca0\ud559\uacfc\uc5d0 \uc7ac\ud559\uc911\uc778
>> \ubcc0\uaddc\ud64d\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4.'],
>> u'article_write': [u'write'], u'board_name': [u'test'], u'write_type':
>> [u'write'], u'file1_fi': [u'', u'']}>,
>

Re: "TSocket read 0 bytes" when dictionary contains unicode character on 64-bit Ubuntu

Posted by David Reiss <dr...@facebook.com>.
It looks like the server closed the connection without sending back
a response.  I would take a look at the server error log.

--David

Francisco Byun wrote:
> Hello. I'm running a BBS written in Python which use Thrift as the
> protocol between Backend & Frontend server. Recently I tried to
> migrate Frontend server. Former Frontend server was 32-bit Ubuntu
> server. New Frontend server is 64-bit Ubuntu server with doubled
> memory.
> 
> But I failed.
> 
> When Frontend ask Backend to send some information, it works fine. But
> when Frontend tries to send some information, it does not work very
> well. For example, I tried to write an article written in English,
> everything was fine. But when I tried to write an article written in
> Korean, it just screwed up with following traceback.
> 
> What should I inspect? Is this reported Thrift problem, or my code is
> wrong? (But identical source works fine with 32-bit Ubuntu server
> 
> .)
> 
> Traceback (most recent call last):
> 
>  File "/usr/local/lib/python2.6/dist-packages/Django-1.2-py2.6.egg/django/core/handlers/base.py",
> line 100, in get_response
>    response = callback(request, *callback_args, **callback_kwargs)
> 
>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>    return f(*args, **argv)
> 
>  File "/home/ara/arara/warara/board/views.py", line 118, in write
>    return write_(request, board_name)
> 
>  File "/home/ara/arara/warara/__init__.py", line 24, in check_error
>    return f(*args, **argv)
> 
>  File "/home/ara/arara/warara/board/views.py", line 169, in write_
>    article_id = server.article_manager.write_article(sess, board_name,
> WrittenArticle(**article_dic))
> 
>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
> 607, in write_article
>    return self.recv_write_article()
> 
>  File "/home/ara/arara/gen-py/arara_thrift/ArticleManager.py", line
> 620, in recv_write_article
>    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
> 
>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
> line 126, in readMessageBegin
>    sz = self.readI32()
> 
>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/protocol/TBinaryProtocol.py",
> line 203, in readI32
>    buff = self.trans.readAll(4)
> 
>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
> line 58, in readAll
>    chunk = self.read(sz-have)
> 
>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TTransport.py",
> line 155, in read
>    self.__rbuf = StringIO(self.__trans.read(max(sz, self.DEFAULT_BUFFER)))
> 
>  File "/usr/local/lib/python2.6/dist-packages/Thrift-0.2.0-py2.6-linux-x86_64.egg/thrift/transport/TSocket.py",
> line 94, in read
>    raise TTransportException(type=TTransportException.END_OF_FILE,
> message='TSocket read 0 bytes')
> 
> TTransportException: TSocket read 0 bytes
> 
> <ModPythonRequest
> path:/board/test/write/,
> GET:<QueryDict: {}>,
> POST:<QueryDict: {u'file1': [u'', u''], u'delete_file': [u''],
> u'article_no': [u''], u'title': [u'test'], u'text': [u'--\r\nKAIST
> \ucca0\ud559\uacfc\uc5d0 \uc7ac\ud559\uc911\uc778
> \ubcc0\uaddc\ud64d\uc774\ub77c\uace0 \ud569\ub2c8\ub2e4.'],
> u'article_write': [u'write'], u'board_name': [u'test'], u'write_type':
> [u'write'], u'file1_fi': [u'', u'']}>,