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

Connection to padawan.php timed out #13

Closed
okdewit opened this issue Nov 23, 2016 · 11 comments
Closed

Connection to padawan.php timed out #13

okdewit opened this issue Nov 23, 2016 · 11 comments

Comments

@okdewit
Copy link

okdewit commented Nov 23, 2016

I have trouble debugging this.

  • I have padawan.php installed globally, through composer.
  • The following is in my vimrc (which is sourced from the neovim config):
if has('nvim')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'pbogut/deoplete-padawan'
endif
  • Running :CheckHealth shows no problems with python or ruby.
  • padawan generate finished without errors
  • After starting nvim, running deoplete#sources#padawan#StartServer() seems to create a file in /tmp/padawan-server.log, and it shows up as a running process.
  • Running deoplete#sources#padawan#RestartServer() adds the following to the log file:
POST /kill
Goodbye
Response time: 0.0035698413848877
tail: /tmp/padawan-server.log: file truncated
  • Visiting the address contained in g:deoplete#sources#padawan#server_addr in the browser gives me an ERR_EMPTY_RESPONSE, and drops a GET / in the log.
  • Both composer, padawan and padawan-server are on my path.

Whenever I type $object-> or Class:: or something like that, it just shows "Connection to padawan.php timed out", which is an error generated by this plugin.

Any idea on how to debug this further? Thanks!

@pbogut
Copy link
Member

pbogut commented Nov 23, 2016

@okdewit
Can you show me what's in the /tmp/padawan-server.log file when you typing $object-> or Class::, please?

Visiting http://127.0.0.1:15155/ shows nothing as it is accepting POST requests only (as far as I'm aware).

@okdewit
Copy link
Author

okdewit commented Nov 23, 2016

$ rm /tmp/padawan-server.log
$ nvim

Neovim opens, and I open a new terminal tab:

$ tail -f /tmp/padawan-server.log
tail: cannot open '/tmp/padawan-server.log' for reading: No such file or directory

So it doesn't seem to autostart (ps aux confirms that), even though g:deoplete#sources#padawan#server_autostart is 1.

Inside Neovim:

:call deoplete#sources#padawan#StartServer()

I see /bin/sh -c padawan-server > /tmp/padawan-server.log in ps aux | grep padawan, and:

$ cat /tmp/padawan-server.log
Started http server on 127.0.0.1:15155

I do :e app/User.php, type $this-> inside any public function, and get the Connection timeout message. Nothing is added to the log, still only Started http server on 127.0.0.1:15155.

Setting up a tail and restarting from withing neovim:

$ tail -f /tmp/padawan-server.log
:call deoplete#sources#padawan#RestartServer()

Gives this as output of the tail command:

Started http server on 127.0.0.1:15155
POST /kill
Goodbye
Response time: 0.0025520324707031
tail: /tmp/padawan-server.log: file truncated

And leaves the log empty.

@mkusher
Copy link
Member

mkusher commented Nov 23, 2016

timeout might be ok for the first time completion, cause padawan loads index and it can be slow. If you try trigger completion multiple times, will it work?

@pbogut
Copy link
Member

pbogut commented Nov 23, 2016

@okdewit
When g:deoplete#sources#padawan#server_autostart = 1 server will be started on first completion (not on vim start).
What I would like you to do is:

  • open nvim
  • :call deoplete#sources#padawan#RestartServer() - just to be sure
  • tail -f /tmp/padawan-server.log
  • Go to your php file and type $object-> or Class::
  • See what log is showing.

Normaly log should show something like:

POST /complete
[2016-11-23 13:09:01] completer.DEBUG: 7.2956085205078E-5 seconds for ast processing [] []
[2016-11-23 13:09:01] completer.DEBUG: Found token '' with type 4 [] []
[2016-11-23 13:09:01] completer.DEBUG: looking for type of this [] []
[2016-11-23 13:09:01] completer.DEBUG: creating entries [] []
[2016-11-23 13:09:01] completer.DEBUG: Creating completion for App\Http\Controllers\Tools\MailerListController [] []
[2016-11-23 13:09:01] completer.DEBUG: 0.00057101249694824 seconds for entries generation [] []
Response time: 0.00073003768920898

@okdewit
Copy link
Author

okdewit commented Nov 23, 2016

Nothing changes in the log when writing code. I've hopped around between files, writing code, running unit tests, commiting to git... just my normal workflow.

Nvim shows the timeout message every time I hit a -> or ::, or when I go into insert mode with my cursor on a method call and add/remove characters.

The tail on the log just shows multiple kill / goodbye / truncate messages, because while working I've tried to restart the padawan server a few times.

@pbogut
Copy link
Member

pbogut commented Nov 23, 2016

Looks like the problem is with the server.
@mkusher any idea how to debug that further?

@mkusher
Copy link
Member

mkusher commented Nov 23, 2016

Looks really strange, maybe let's try netcat test? I mean:

$ nc -l 15155 > test_request

And type something in your php file, the best thing is typing $ into some of your methods. The request should be send and command will exit with status code 0. Then start padawan server and do

$ cat test_request | nc localhost 15155

Paste here results of this test

@okdewit
Copy link
Author

okdewit commented Nov 23, 2016

@mkusher @pbogut:

Thanks for the help so far. It indeed seems to be related to mkusher/padawan.

I had tried to set it up earlier at home on a different machine (Debian workstation), and now it works there.

So I started to compare versions (OS, Neovim, PHP, composer, etc), and suddenly noticed that my work machine (Mint laptop) had the mkusher/padawan master branch, while my home PC pulled in the stable v0.2.1 release.

After downgrading it now works on both machines, I get nice POST /complete calls and debug messages in the log.

Haven't been able to pinpoint yet why the padawan CLI 3.0 doesn't work for me though, it doesn't seem to write during generate either. I had actually been using the .padawan/project file which I had accidentally committed to the repo earlier from my home machine, when the generate command didn't show any errors on the laptop I mistook the file as freshly generated. I've run padawan generate -vvv again with the 3.0 version, and it doesn't write any index, even though there are no completer.ERROR messages.

I'm happy using the previous version, but if I can help by providing more information let me know!

@okdewit
Copy link
Author

okdewit commented Nov 23, 2016

Looks really strange, maybe let's try netcat test

With Padawan CLI 3.0, dumping the request to the file goes well, there is a POST header at the top, and the body is full of url-encoded text from the buffer.

When I start the padawan server again and use cat test_request | nc localhost 15155, it doesn't seem to do anything, it just instantly completes without any error code.

@mkusher
Copy link
Member

mkusher commented Nov 24, 2016

ok, looks like it's a bug in padawan.php itself, not in deoplete plugin

@pbogut
Copy link
Member

pbogut commented Nov 24, 2016

I'm closing it then. Please, move to padawan.php if you wish to check it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants