[Bug 1130512] Re: accept strace block

tony amoshen at 126.com
Wed Feb 20 06:45:40 UTC 2013


** Description changed:

- I used ftp (netkit-ftp-0.17) to get some files when prompt was on, the
- block happened.
+ I used ftp (netkit-ftp-0.17) to get some files when prompt was on, the block happened.
+ BTW. The ftp server is 3CDeamon Version2.0 Revision10
  
  ----
  local: test1.css remote: test1.css
  200 PORT command successful.
  150 File status OK ; about to open data connection
  (#block happened. here is wating...)
  ----
  
  i used strace command to find out the reason.
- the block happened when socket accepted. 
+ the block happened when socket accepted.
  ---
  write(3, "RETR test1.css\r\n", 24) = 24
  rt_sigaction(SIGINT, {0x805630f, [INT], SA_RESTART}, {0x805630f, [INT], SA_RESTART}, 8) = 0
  read(3, "150 File status OK ; about to op"..., 1024) = 52
  write(1, "150 File status OK ; about to op"..., 51) = 51
  rt_sigaction(SIGINT, {0x805630f, [INT], SA_RESTART}, {0x805630f, [INT], SA_RESTART}, 8) = 0
  rt_sigaction(SIGINT, {0x8057fdd, [INT], SA_RESTART}, {0x805630f, [INT], SA_RESTART}, 8) = 0
- accept(5, 
+ accept(5,
  (#wating...)
  ----
  
  the source is below:
  ------
  static FILE *
  dataconn(const char *lmode)
  {
- 	struct sockaddr_in from;
- 	int s, tos;
- 	socklen_t fromlen = sizeof(from);
+  struct sockaddr_in from;
+  int s, tos;
+  socklen_t fromlen = sizeof(from);
  
-                       if (passivemode)
-                       return (fdopen(data, lmode));
+                       if (passivemode)
+                       return (fdopen(data, lmode));
  
- 	s = accept(data, (struct sockaddr *) &from, &fromlen);    --> (here is the problem which block happen.)
- 	if (s < 0) {
- 		perror("ftp: accept");
- 		(void) close(data), data = -1;
- 		return (NULL);
- 	}
- 	(void) close(data);
- 	data = s;
+  s = accept(data, (struct sockaddr *) &from, &fromlen);    --> (here is the problem which block happen.)
+  if (s < 0) {
+   perror("ftp: accept");
+   (void) close(data), data = -1;
+   return (NULL);
+  }
+  (void) close(data);
+  data = s;
  #ifdef IP_TOS
- 	tos = IPTOS_THROUGHPUT;
- 	if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0)
- 		perror("ftp: setsockopt TOS (ignored)");
+  tos = IPTOS_THROUGHPUT;
+  if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0)
+   perror("ftp: setsockopt TOS (ignored)");
  #endif
- 	return (fdopen(data, lmode));
+  return (fdopen(data, lmode));
  }
  
  ------
  
  i search the internet , and found accept will block the process.
- is it a bug? i don't kown how to deal with it. 
- can somebody give me a hand to solve it??? 
+ is it a bug? i don't kown how to deal with it.
+ can somebody give me a hand to solve it???
  thank you.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to netkit-ftp in Ubuntu.
https://bugs.launchpad.net/bugs/1130512

Title:
  accept strace block

Status in “netkit-ftp” package in Ubuntu:
  New

Bug description:
  I used ftp (netkit-ftp-0.17) to get some files when prompt was on, the block happened.
  BTW. The ftp server is 3CDeamon Version2.0 Revision10

  ----
  local: test1.css remote: test1.css
  200 PORT command successful.
  150 File status OK ; about to open data connection
  (#block happened. here is wating...)
  ----

  i used strace command to find out the reason.
  the block happened when socket accepted.
  ---
  write(3, "RETR test1.css\r\n", 24) = 24
  rt_sigaction(SIGINT, {0x805630f, [INT], SA_RESTART}, {0x805630f, [INT], SA_RESTART}, 8) = 0
  read(3, "150 File status OK ; about to op"..., 1024) = 52
  write(1, "150 File status OK ; about to op"..., 51) = 51
  rt_sigaction(SIGINT, {0x805630f, [INT], SA_RESTART}, {0x805630f, [INT], SA_RESTART}, 8) = 0
  rt_sigaction(SIGINT, {0x8057fdd, [INT], SA_RESTART}, {0x805630f, [INT], SA_RESTART}, 8) = 0
  accept(5,
  (#wating...)
  ----

  the source is below:
  ------
  static FILE *
  dataconn(const char *lmode)
  {
   struct sockaddr_in from;
   int s, tos;
   socklen_t fromlen = sizeof(from);

                        if (passivemode)
                        return (fdopen(data, lmode));

   s = accept(data, (struct sockaddr *) &from, &fromlen);    --> (here is the problem which block happen.)
   if (s < 0) {
    perror("ftp: accept");
    (void) close(data), data = -1;
    return (NULL);
   }
   (void) close(data);
   data = s;
  #ifdef IP_TOS
   tos = IPTOS_THROUGHPUT;
   if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&tos, sizeof(int)) < 0)
    perror("ftp: setsockopt TOS (ignored)");
  #endif
   return (fdopen(data, lmode));
  }

  ------

  i search the internet , and found accept will block the process.
  is it a bug? i don't kown how to deal with it.
  can somebody give me a hand to solve it???
  thank you.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netkit-ftp/+bug/1130512/+subscriptions




More information about the foundations-bugs mailing list