Bug 3902 - 500 Command failed. : globus_xio: An end of file occurred
: 500 Command failed. : globus_xio: An end of file occurred
Status: RESOLVED FIXED
: GridFTP
GridFTP
: 4.0.0
: Macintosh MacOS
: P3 normal
: 4.0.2
Assigned To:
:
:
: 3917
:
  Show dependency treegraph
 
Reported: 2005-11-10 00:20 by
Modified: 2006-04-18 14:15 (History)


Attachments
an ad hoc patch. (1.87 KB, patch)
2005-12-22 00:33, ASOU Masato
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-11-10 00:20:11
I have installed Globus Toolkit 4.0.1 on my Mac mini (MacOS X/Tiger).
globus-gridftp-server is invoked by xinetd.

    $ uname -msrv
    Darwin 8.2.1 Darwin Kernel Version 8.2.1: Fri Jun 24 23:31:10 PDT 2005;
root:xnu-792.3.2.obj~1/RELEASE_PPC Power Macintosh

I hava a problem. globus-url-copy faild an error as follows.

    $ globus-url-copy file:///tmp/src.txt gsiftp://example.org/tmp/dest.txt

    error: globus_ftp_client: the server responded with an error
    500 Command failed. : globus_xio: An end of file occurred

When it fails, 0 byte of /tmp/dest.txt file is created.

    $ ls -l /tmp/src.txt /tmp/dest.txt
    -rw-r--r--   1 asou  wheel   0 Nov 10 12:09 /tmp/dest.txt
    -rw-r--r--   1 asou  wheel  38 Nov 10 10:01 /tmp/src.txt

example.org and client are the same machines.

It fails frequently. It succeed sometimes. Although I tried it 4
times. It failed 3 times, it succeeded once as follows.

    $ globus-url-copy file:///tmp/src.txt gsiftp://example.org/tmp/dest.txt
    
    error: globus_ftp_client: the server responded with an error
    500 Command failed. : globus_xio: An end of file occurred
    
    $ globus-url-copy file:///tmp/src.txt gsiftp://example.org/tmp/dest.txt
    
    error: globus_ftp_client: the server responded with an error
    500 Command failed. : globus_xio: An end of file occurred
    
    $ globus-url-copy file:///tmp/src.txt gsiftp://example.org/tmp/dest.txt
    $ globus-url-copy file:///tmp/src.txt gsiftp://example.org/tmp/dest.txt
    
    error: globus_ftp_client: the server responded with an error
    500 Command failed. : globus_xio: An end of file occurred

The following error is also occurred sometimes.

    $ globus-url-copy file:///tmp/src.txt gsiftp://example.org/tmp/dest.txt
    
    error: globus_ftp_client: the server responded with an error
    500 500-Command failed. : globus_xio_gsi: gss_accept_sec_context failed.
    500-OpenSSL Error: a_verify.c:162: in library: asn1 encoding routines,
function ASN1_verify: EVP lib
    500-OpenSSL Error: rsa_eay.c:580: in library: rsa routines, function
RSA_EAY_PUBLIC_DECRYPT: padding check failed
    500-OpenSSL Error: rsa_pk1.c:100: in library: rsa routines, function
RSA_padding_check_PKCS1_type_1: block type is not 01
    500 End.

I have installed Globus Toolkit from gt4.0.1-all-source-installer.tar.bz2.
It installed in the following procedures.

    $ ./configure --prefix=$GLOBUS_LOCATION --with-flavor=gcc32dbg
    $ make
    $ make install

globus-gridftp-server was rebuild with --static because an error
occurs.

    $ . $GLOBUS_LOCATION/etc/globus-user-env.sh
    $ $GLOBUS_LOCATION/sbin/globus-gridftp-server 
    dyld: Symbol not found: _globus_gridftp_server_remote_module
      Referenced from:
/usr/local/work-gt/gt4.0.1/lib/libglobus_gridftp_server_gcc32dbg.0.dylib
      Expected in: flat namespace
    
    Trace/BPT trap

globus-gridftp-server installed in the following procedures.

    $ make clean
    $ make distclean
    $ ./configure --prefix=$GLOBUS_LOCATION --with-flavor=gcc32dbg
--with-buildopts="--static"
    $ make gpt globus-gridftp-server

Thanks.
------- Comment #1 From 2005-12-01 23:07:24 -------
Can you run the server in daemon mode, and send logs.

as root, this will need to be restarted after each connection. if not root, be 
sure to use the -s option of globus-url-copy

set GLOBUS_ERROR_OUTPUT=1 GLOBUS_ERROR_VERBOSE=1 in the env

globus-gridftp-server -debug -d all -l /tmp/gridftplog -p <port>

if the process segfaults or asserts, please run it under gdb:
gdb --args <above command>
in gdb type 'run' to start it, and 'where' to show a trace at the time of 
failure. -- send that output.

Mike

------- Comment #2 From 2005-12-02 01:50:49 -------
I tried as root.

    root# ulimit -c unlimited
    root# ulimit -a
    core file size        (blocks, -c) unlimited
    data seg size         (kbytes, -d) 6144
    file size             (blocks, -f) unlimited
    max locked memory     (kbytes, -l) unlimited
    max memory size       (kbytes, -m) unlimited
    open files                    (-n) 256
    pipe size          (512 bytes, -p) 1
    stack size            (kbytes, -s) 8192
    cpu time             (seconds, -t) unlimited
    max user processes            (-u) 100
    virtual memory        (kbytes, -v) unlimited
    root# rm /tmp/gridftplog
    rm: /tmp/gridftplog: No such file or directory
    root# $GLOBUS_LOCATION/sbin/globus-gridftp-server -debug -d all -l
/tmp/gridftplog -p 11100

I run the globus-url-copy as not root.

    asou$ rm /tmp/dest.txt
    asou$ cat /tmp/src.txt
    Hello, World.
    asou$ globus-url-copy file:///tmp/src.txt
gsiftp://example.org:11100/tmp/dest.txt

    error: globus_ftp_client: the server responded with an error
    500 Command failed. : globus_xio: An end of file occurred
    asou$ ls -l /tmp/{src,dest}.txt
    -rw-r--r--   1 asou  wheel   0 Dec  2 15:41 /tmp/dest.txt
    -rw-r--r--   1 asou  wheel  14 Dec  2 15:26 /tmp/src.txt

globus-gridftp-server was finished when globus-url-copy was finished.
No core files were created.

    root# ls core*
    ls: core*: No such file or directory

gridftplog as follows.

    asou$ ls -l /tmp/gridftplog
    -rw-r--r--   1 root  wheel  2819 Dec  2 15:41 /tmp/gridftplog
    asou$ cat /tmp/gridftplog
    [15484] Fri Dec  2 15:39:13 2005 :: Server started in daemon mode.
    [15484] Fri Dec  2 15:41:11 2005 :: New connection from: example.org:55331
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [CLIENT]: USER
:globus-mapping:
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [SERVER]: 331
Password required for :globus-mapping:.
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [CLIENT]: PASS
    [15484] Fri Dec  2 15:41:11 2005 :: User asou successfully authorized
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [CLIENT]: PASS
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [SERVER]: 230 User
asou logged in.
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [CLIENT]: SITE HELP
    [15484] Fri Dec  2 15:41:11 2005 :: example.org:55331: [SERVER]: 214-The
following commands are recognized:
        ALLO    ESTO    RNTO    APPE    DCAU    MODE    SIZE    STRU
        TYPE    DELE    SITE    CWD     ERET    FEAT    LIST    NLST
        MLSD    MLST    PORT    PROT    EPRT    PWD     QUIT    REST
        STAT    SYST    MKD     RMD     CDUP    HELP    NOOP    EPSV
        PASV    TREV    SBUF    MDTM    CKSM    OPTS    PASS    SPAS
        PBSZ    SPOR    RETR    STOR    USER    RNFR    LANG
    214 End
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: FEAT
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]:
211-Extensions supported
     UTF8
     LANG EN
     DCAU
     PARALLEL
     SIZE
     MLST
Type*;Size*;Modify*;Perm*;Charset;UNIX.mode*;UNIX.owner*;UNIX.group*;Unique*;UNIX.slink*;
     ERET
     ESTO
     SPAS
     SPOR
     REST STREAM
     MDTM
    211 End.
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: TYPE I
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]: 200 Type
set to I.
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: PBSZ 1048576
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]: 200
PBSZ=1048576
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: PASV
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]: 227
Entering Passive Mode (192,50,74,140,216,36)
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: ALLO 14
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]: 200 ALLO
command successful.
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: STOR
/tmp/dest.txt
    [15484] Fri Dec  2 15:41:12 2005 :: Finished transferring "/tmp/dest.txt".
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]: 500 Command
failed. : globus_xio: An end of file occurred
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [CLIENT]: QUIT
    [15484] Fri Dec  2 15:41:12 2005 :: example.org:55331: [SERVER]: 221 Goodbye.
    [15484] Fri Dec  2 15:41:12 2005 :: Closed connection from example.org:55331

Thanks.
------- Comment #3 From 2005-12-02 02:21:51 -------
Please try running globus-url-copy with the -nodcau option.

If that works, do you have /etc/grid-security/certificates as well as 
~/.globus/certificates, or are you setting X509_CERT_DIR on the server or 
client environment?
------- Comment #4 From 2005-12-04 20:53:18 -------
I tried globus-url-copy -nodcau. It's works fine.

I have /etc/grid-security/certificates. I dont have ~/.globus/certificates.
X509_CERT_DIR is not set. A server and a client are the same machine.
------- Comment #5 From 2005-12-22 00:33:38 -------
Created an attachment (id=795) [details]
an ad hoc patch.

I have solved this problem.  I have made an ad hoc patch and
rebuild the GT4. Then globus-url-copy was successed without the
-nodcau option.
------- Comment #6 From 2005-12-22 00:40:45 -------
I found tow bugs. One is GSI and another is FTP.

  - In GSI, sysconf() has returned an error.

  - FTP is mistaken in the usage of _SC_GETPW_R_SIZE_MAX. 

The details of the bug of GSI are shown below:

    The following is an extract from
    source-trees/gsi/sysconfig/source/library/globus_gsi_system_config.c:

      3947  #ifdef _SC_GETPW_R_SIZE_MAX
      3948      buf_len = sysconf(_SC_GETPW_R_SIZE_MAX) + 1;
      3949  #else
      3950      buf_len = 1024;
      3951  #endif

      4344  #ifdef _SC_GETPW_R_SIZE_MAX
      4345      buf_len = sysconf(_SC_GETPW_R_SIZE_MAX) + 1;
      4346  #else
      4347      buf_len = 1024;
      4348  #endif

    _SC_GETPW_R_SIZE_MAX is defined on Mac OS X. However,
    sysconf(_SC_GETPW_R_SIZE_MAX) returns an error. Therefore, the
    constant is used as below when error was retured.

        buf_len  = sysconf(_SC_GETPW_R_SIZE_MAX);
        if (buf_len < 0) {
            fprintf(stderr, "Warning: sysconf() returned error.\n");
            buf_len = 1024;
        }

The details of the bug of FTP are shown below:

    The following is an extract from 
    source-trees/gridftp/server/src/globus_i_gfs_data.c:

        23  #if defined(_SC_GETPW_R_SIZE_MAX)
        24  #define GSC_GETPW_PWBUFSIZE         _SC_GETPW_R_SIZE_MAX
        25  #else
        26  #define GSC_GETPW_PWBUFSIZE        (USER_NAME_MAX*3)+(PATH_MAX*2)
        27  #endif

       460      char                                pw_buffer[GSC_GETPW_PWBUFSIZE];
       461      struct passwd                       pwent_mem;
       462      struct passwd *                     pw_result;
       463      struct passwd *                     pwent = NULL;
       464
       465      rc = globus_libc_getpwuid_r(getuid(), &pwent_mem, pw_buffer,
       466                  GSC_GETPW_PWBUFSIZE, &pw_result);

       482      char                                pw_buffer[GSC_GETPW_PWBUFSIZE];
       483      struct passwd                       pwent_mem;
       484      struct passwd *                     pw_result;
       485      struct passwd *                     pwent = NULL;
       486
       487      rc = globus_libc_getpwnam_r(
       488          (char *)name, &pwent_mem, pw_buffer,GSC_GETPW_PWBUFSIZE,
&pw_result);

    _SC_GETPW_R_SIZE_MAX is an argument passed to sysconf(). It is not
    the length of buffer.

    The example of use _SC_GETPW_R_SIZE_MAX is below.

        #define GSC_GETPW_PWBUFSIZE        (USER_NAME_MAX*3)+(PATH_MAX*2)
        long length;
        cahr *pw_buffer;

        length  = sysconf(_SC_GETPW_R_SIZE_MAX);
        if (length < 0) {
            fprintf(stderr, "Warning: sysconf() returned error.\n");
            length = GSC_GETPW_PWBUFSIZE;
        }
        pw_buffer = malloc(length);
        if (pw_puffer == NULL) {
            fprintf(stderr, "Couldn't allocate pw_buffer.\n");
            exit(1);
        }
------- Comment #7 From 2006-02-07 20:39:45 -------
Thanks, a fix has been committed to CVS.  4.0.1 update packages should be 
available soon at: http://www.globus.org/toolkit/advisories.html.

Mike