-
Notifications
You must be signed in to change notification settings - Fork 284
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
Cannot connect through mysql #28
Comments
If I just wait a while, the following happens: /tmp/.rdmd-1000/home/simendsjo/code/tmp/vibetest/source/app.d.2A2600FC8A6DEC8A717A224A7D9CEB8E(pure @safe bool std.exception.enforce!(bool, "../../vibe/vibe.d/bin/../source/vibe/core/drivers/libevent2_tcp.d", 271).enforce(bool, lazy const(char)[])+0x46) [0x4caf32] |
_socket.read(_packet); in Connection.init_connection is where it fails |
By the way, if you enclose your pastes in triple backticks, you'll get a monospace font and Markdown will leave the snipped alone. |
Hmm.. Is std.socket.receive just receiving until it receives 0 bytes, while your read() is trying to fetch buffer.length bytes? How about adding an overload to readAll to supply your own buffer or something like that? |
@klickverbot: Thanks, will do. I've been removing some --- lines and such to avoid the worst formatting issues :) |
Never mind what I said about the performance issues. Looks like the _packet.length is set to the actual length in other calls to read(). I'll create a pull. |
Nah, changing to readAll() hangs quite a while on while(!empty) in readAllDefault(). I think I need a method taking a buffer and just up to buffer.length bytes. |
Yeah, I think both the original receive() and readAll() are quite hackish because they depend on the network and on the order of packets in the protocol. I have checked in an attempt to parse the real length of the packet. It seems to get further now but the connection is now closed by the server when the next getPacket() in Connection.open() is called. Probably it's necessary to go through the protocol and all places where receive() was called carfully to see if there are other occasions where receive() was expected to return partial data. |
Btw. readAll() is supposed to read all data available on the connection until it is closed. So this is not really the right candidate (it is a bug if it returns earlier). The more or less equivalent behavior to receive() would be:
|
modules/mysql-native/source/mysql.d(1311): Error: == has no effect in expression (this._packet.length == (cast(InputStream)this._socket).leastSize()) |
Hm I'm not sure which line exactly that refers to but I have checked in another fix based on the leastSize method. I've also been able to partially test it and it seems to correctly fail with an auth failure for me. |
Thanks, it works now. |
It just hangs. I was able to connect before the library was integrated to vibe, so I guess the problem might be there.
I don't know vibe yet - anything in particular you want me to investigate?
(gdb) r
Starting program: /home/simendsjo/code/tmp/vibetest/app
[Thread debugging using libthread_db enabled]
[7FFFF7EC8F00:00000000 WRN] Failed to parse config file /etc/vibe/vibe.conf: /etc/vibe/vibe.conf: No such file or directory
[7FFFF7EC8F00:00000000 INF] Listening on 0.0.0.0 port 8080 succeeded
[7FFFF7EC8F00:00000000 ERR] Error binding listening socket
[7FFFF7EC8F00:00000000 INF] Listening on :: port 8080 failed
[7FFFF7EC8F00:00000000 INF] Running event loop...
connecting
^C
Program received signal SIGINT, Interrupt.
0x00007ffff6a29bd3 in __epoll_wait_nocancel () at ../sysdeps/unix/syscall-template.S:82
82 ../sysdeps/unix/syscall-template.S: No such file or directory.
in ../sysdeps/unix/syscall-template.S
(gdb) bt
#0 0x00007ffff6a29bd3 in __epoll_wait_nocancel () at ../sysdeps/unix/syscall-template.S:82
#1 0x00007ffff7bb98e7 in ?? () from /usr/lib/libevent-2.0.so.5
#2 0x00007ffff7ba4c44 in event_base_loop () from /usr/lib/libevent-2.0.so.5
#3 0x00000000004e9952 in vibe.core.drivers.libevent2.Libevent2Driver.runEventLoop() (this=0x7ffff7ecafc0)
#4 0x00000000004ce530 in vibe.core.core.start() () at ../../vibe/vibe.d/bin/../source/vibe/core/core.d:42
#5 0x00000000004fbf64 in D main (args=...) at ../../vibe/vibe.d/bin/../source/vibe/appmain.d:38
#6 0x0000000000557b73 in rt.dmain2.main() ()
#7 0x0000000000822010 in ?? ()
#8 0x00007ffff7ecaf00 in ?? ()
#9 0x00007fffffffdf50 in ?? ()
#10 0x00007fffffffde20 in ?? ()
#11 0x00000000005574f3 in rt.dmain2.main() ()
#12 0x0000000000000001 in ?? ()
#13 0x0000000000000025 in ?? ()
#14 0x0000000000822020 in ?? ()
#15 0x00007fffffffdf50 in ?? ()
#16 0x00007fffffffdc60 in ?? ()
#17 0x0000000000000000 in ?? ()
The text was updated successfully, but these errors were encountered: