tihu-nlp / tihu

Persian Text-To-Speech
http://lilak-project.com/tihu_demo.php
Other
84 stars 11 forks source link

Segmentation fault when running locally #44

Closed shotor closed 4 years ago

shotor commented 4 years ago

Hi @b00f

I'm trying to get the grpc server to run locally so I can find out why the generated js client doesn't work. I think it has to do with docker networking and what the generated client is using internally to do the grpc calls. So I want to run it locally to confirm but I get a segmentation fault when I try to run the server:

./tihu_server 0.0.0.0:50051 /tihu/build/libtihu.so ""
[1]    29866 segmentation fault (core dumped)  ./tihu_server 0.0.0.0:50051 /tihu/build/libtihu.so ""

Steps that I took:

Following instructions from the Dockerfile on an ubuntu 18.04 machine:

Protobuf installation first. No errors.

When building grpc I got the error:

error adding symbols: DSO missing from command line

I solved that by modifying the makefile as suggested here: https://github.com/grpc/grpc/issues/9549#issuecomment-281294118

After that installation runs without error and I have libprotoc.so.18 in /usr/local/lib

Running make on the tihu repo goes fine except for this warning when running make grpc:

/usr/bin/ld: warning: libprotobuf.so.10, needed by /usr/local/lib/libgrpc++_reflection.so, may conflict with libprotobuf.so.18

I tried to follow the warning and uninstalled protobuf then installed protobuf 2.7.0 so I get libprotoc.so.10. But that doesn't seem to be the answer:

./tihu_server 0.0.0.0:50051 /tihu/build/libtihu.so ""
./tihu_server: error while loading shared libraries: libprotobuf.so.18: cannot open shared object file: No such file or directory

I don't know how to proceed from here

b00f commented 4 years ago

Sorry for that. Installing gRPC is a pain in the butt! I tried to compiled gRPC inside the docker to not face these kind of issues. Let me dig into it.

shotor commented 4 years ago

No worries! Maybe wait a little bit with that. I was reading about grpc + react-native and I might have to do grpc calls differently, using native swift and java module instead of js so those might just work out of the box.

Also reading grpc repo they seem to recommend Bazel to install it. Is this something you would be interested in? From what I can see it’s dependency management similar to npm/yarn for c++. I can try to migrate the repo to that.

b00f commented 4 years ago

I do remember I had tough times while writing the docker. It tried some recommended ways, but finally I decided to compile it manually inside the docker. which works fine right now. I think docker has no issue, because I tested it with go lang client before. I don't know why I didn't publish the code. and unfortunately I can't find it right now. Maybe because it was so dirty code!

shotor commented 4 years ago

yeah there's definitely something wrong with the libraries I used to generate the client.

I used yet another library to implement a mock grpc server and using the client that it also generated I can successfully call the mock api as well as the docker api: https://github.com/tihu-nlp/tihu-native/blob/master/mock-server/test/integration.test.ts

The two broken libraries I tried before, give the same error when running against the mock server

I'm closing this issue, I don't think it's worth it to go through the pain of getting grpc to work locally when it works fine with docker.

I'll update the other repo when I get grpc working through react-native