Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is this thread-safe #53

Closed
techloghub opened this issue May 15, 2019 · 3 comments
Closed

is this thread-safe #53

techloghub opened this issue May 15, 2019 · 3 comments
Labels
need more info question Further information is requested

Comments

@techloghub
Copy link

techloghub commented May 15, 2019

I tried to run some examples under multithreading environment,but I but I got a lot of exceptions.
just like:

  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\protocol\binary.py", line 386, in read_struct
    return read_struct(self.trans, obj, self.decode_response)
  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\protocol\binary.py", line 294, in read_struct
    f_type, fid = read_field_begin(inbuf)
  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\protocol\binary.py", line 189, in read_field_begin
    f_type = unpack_i8(inbuf.read(1))
  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\transport\__init__.py", line 32, in read
    return readall(self._read, sz)
  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\transport\__init__.py", line 14, in readall
    chunk = read_fn(sz - have)
  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\transport\buffered\__init__.py", line 39, in _read
    self._rbuf = BytesIO(self._trans.read(max(sz, self._buf_size)))
  File "D:\Workspace\work\pypi_packages\thriftpy2src\thriftpy2\transport\socket.py", line 109, in read
    buff = self.sock.recv(sz)
AttributeError: 'NoneType' object has no attribute 'recv'
@ethe ethe added the question Further information is requested label May 16, 2019
@ethe
Copy link
Member

ethe commented May 16, 2019

Thriftpy does not promise thread safety. But I am not sure your issue is related with thread safety, please give more info for discussing.

@ethe
Copy link
Member

ethe commented May 16, 2019

In my opinion, Thriftpy has already supported TThreadedServer, maybe you should use this.

@techloghub
Copy link
Author

THX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need more info question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants