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

auto_reconnect not working #76

Closed
rosslagerwall opened this issue May 11, 2014 · 0 comments · Fixed by #88
Closed

auto_reconnect not working #76

rosslagerwall opened this issue May 11, 2014 · 0 comments · Fixed by #88

Comments

@rosslagerwall
Copy link
Contributor

A basic synchronous program which does nfs_stat(); sleep(800); nfs_stat(); hangs in the second nfs_stat call.

It would appear that the auto reconnect is not doing it'sjob and so it calls poll on a file descriptor that is -1 which than makes poll wait indefinitely.

0x00007f1043758800 in __poll_nocancel () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007f1043758800 in __poll_nocancel () from /usr/lib/libc.so.6
#1  0x00007f1043a3d8ee in wait_for_nfs_reply (nfs=0x1b8e010, cb_data=0x7ffffdda6770) at libnfs-sync.c:141
#2  0x00007f1043a3db69 in nfs_stat (nfs=0x1b8e010, path=0x4009d3 "/test3", st=0x7ffffdda67b0) at libnfs-sync.c:235
#3  0x00000000004008f0 in main () at test.c:31
(gdb) frame 1
#1  0x00007f1043a3d8ee in wait_for_nfs_reply (nfs=0x1b8e010, cb_data=0x7ffffdda6770) at libnfs-sync.c:141
141         if (poll(&pfd, 1, -1) < 0) {
(gdb) list
136 
137     while (!cb_data->is_finished) {
138 
139         pfd.fd = nfs_get_fd(nfs);
140         pfd.events = nfs_which_events(nfs);
141         if (poll(&pfd, 1, -1) < 0) {
142             nfs_set_error(nfs, "Poll failed");
143             cb_data->status = -EIO;
144             break;
145         }
(gdb) p nfs
$1 = (struct nfs_context *) 0x1b8e010
(gdb) p *nfs
$2 = {rpc = 0x1b8e060, server = 0x1b92350 "127.0.0.1", export = 0x1b92370 "/exports/share", rootfh = {data = {data_len = 28, data_val = 0x1b936e0 "\001"}}, readmax = 262144, writemax = 262144, 
  cwd = 0x1b92280 "/"}
(gdb) p *nfs->rpc
$3 = {magic = 3336856629, fd = -1, is_connected = 0, error_string = 0x1b93810 "Socket has been closed", connect_cb = 0x0, connect_data = 0x1b93710, auth = 0x1b92210, xid = 3486973964, 
  encodebuf = 0x7f1043d51010 "\200", encodebuflen = 1052672, outqueue = {head = 0x1b93550, tail = 0x1b93550}, udp_src = {ss_family = 0, __ss_align = 0, __ss_padding = '\000' <repeats 111 times>}, waitpdu = {{
      head = 0x0, tail = 0x0} <repeats 1024 times>}, inpos = 0, insize = 0, inbuf = 0x0, is_udp = 0, udp_dest = 0x0, is_broadcast = 0, s = {ss_family = 2, __ss_align = 0, 
    __ss_padding = '\000' <repeats 111 times>}, auto_reconnect = 0, fragments = 0x0, tcp_syncnt = -1, uid = 1000, gid = 1000}

Thanks for looking into this.

rosslagerwall added a commit to rosslagerwall/libnfs that referenced this issue Jul 19, 2014
Since rpc_connect_async sets autoreconnect to 0, turn autoreconnect on
after the connection has completed, not before.

This fixes sahlberg#76.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
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

Successfully merging a pull request may close this issue.

1 participant