bitwiseworks / libcx

kLIBC Extension Library
GNU Lesser General Public License v2.1
11 stars 1 forks source link

NcFTP now crashes in libcx's select() #100

Closed dryeo closed 3 years ago

dryeo commented 3 years ago

If ncftp's connection times out and then ncftp is closed, it now (since updating to the exp versions of libc and libcx) traps

To reproduce, open a ftp connection such as the testers ftp and download a file. Wait until the server times out. Both Lewis and I saw it after waiting overnight. I also experienced it after locally running ftpser, downloading a file and waiting a couple of hours. Then enter bye to close the connection and program. At this point it crashes,

ncftp / > bye

Killed by SIGSEGV
pid=0xb39e ppid=0xb393 tid=0x0001 slot=0x00f9 pri=0x0200 mc=0x0001 ps=0x0010
W:\USR\BIN\NCFTP.EXE
cs:eip=0000:00000005      ss:esp=0000:00000000      ebp=00000053
 ds=0000      es=0000      fs=0000      gs=0000     efl=00000000
eax=0016e398 ebx=1ffc9d7c ecx=0016e3ac edx=0016e3d0 edi=00000000 esi=0016ff9c
Creating B39E_01.TRP
Moved b39e_01.TRP to W:\var\log\app\61215a13-b39e_01-NCFTP-exceptq.txt

It should simply close the program.

______________________________________________________________________

 Exception Report - created 2021/08/21 19:54:59
______________________________________________________________________

 LIBC: Killed by SIGSEGV

 Hostname:         ARCAOS-44454C4
 OS2/eCS Version:  2.45
 # of Processors:  4
 Physical Memory:  3241 mb
 Virt Addr Limit:  3072 mb
 Exceptq Version:  7.11.5-shl BETA8 (Jun  1 2020 18:37:02)

______________________________________________________________________

 Exception C0000005 - Access Violation
______________________________________________________________________

 Process:  W:\USR\BIN\NCFTP.EXE (03/04/2019 08:06:11 186,095)
 PID:      B39E (45982)
 TID:      01 (1)
 Priority: 200

 Filename: W:\USR\LIB\LIBCX0.DLL (08/16/2021 14:09:29 65,099)
 Address:  005B:1CBC313C (0001:0000313C)
 Cause:    Attempted to read from 00000000
           (not a valid address)

______________________________________________________________________

 Failing Instruction
______________________________________________________________________

 1CBC3130  MOV  EAX, ECX          (89c8)
 1CBC3132  MOV  EDX, 0x1          (ba 01000000)
 1CBC3137  SHR  EAX, 0x5          (c1e8 05)
 1CBC313A  SHL  EDX, CL           (d3e2)
 1CBC313C >TEST [EDI+EAX*4], EDX  (851487)
 1CBC313F  JNZ  0x1cbc3154        (75 13)
 1CBC3141  MOV  EBX, [EBP-0x4b8]  (8b9d 48fbffff)
 1CBC3147  TEST [EBX+EAX*4], EDX  (851483)

______________________________________________________________________

 Registers
______________________________________________________________________

 EAX : 00000000   EBX  : 0016EA40   ECX : 00000000   EDX  : 00000001
 ESI : 00000005   EDI  : 00000000
 ESP : 0016E500   EBP  : 0016E9E8   EIP : 1CBC313C   EFLG : 00010246
 CS  : 005B       CSLIM: FFFFFFFF   SS  : 0053       SSLIM: FFFFFFFF

 EAX : not a valid address
 EBX : read/write memory on this thread's stack
 ECX : not a valid address
 EDX : not a valid address
 ESI : not a valid address
 EDI : not a valid address

______________________________________________________________________

 Stack Info for Thread 01
______________________________________________________________________

   Size       Base        ESP         Max         Top
 00100000   00170000 -> 0016E500 -> 0016B000 -> 00070000

______________________________________________________________________

 Call Stack
______________________________________________________________________

   EBP     Address    Module     Obj:Offset    Nearest Public Symbol
 --------  ---------  --------  -------------  -----------------------
 Trap  ->  1CBC313C   LIBCX0    0001:0000313C  select.c#215 _select + 4EC 0001:00002C50 (D:\Users\dmik\rpmbuild\BUILD\libcx-0.7.1\src\select\select.c)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     nfds                 32 bit signed                6
   12    readfds              pointer to type 0x202        0
   16    writefds             pointer to type 0x202        16EA40
   20    exceptfds            pointer to type 0x202        0
   24    timeout              pointer to type 0x207        16EA38
  -1032  regular_fds          0x202                        0
  -776   r_new                0x202                        0
  -520   w_new                0x202                        0
  -264   e_new                0x202                        0
  -1140  st                   0x24A                        16EA5F
  -1140  st                   0x24A                        16EA5F
  -1140  t_new                0x207                        16EA5F
  -1148  dummy                32 bit signed                16E624
  -1144  dummy_len            32 bit unsigned              2
  -1148  dummy                32 bit signed                16E624
  -1144  dummy_len            32 bit unsigned              2
  -1148  dummy                32 bit signed                16E624
  -1144  dummy_len            32 bit unsigned              2
  -1148  dummy                32 bit signed                16E624
  -1144  dummy_len            32 bit unsigned              2
  -1148  dummy                32 bit signed                16E624
  -1144  dummy_len            32 bit unsigned              2
  -1140  t_new                0x207                        16EA5F
  -1140  t_new                0x207                        16EA5F
  -1140  t_new                0x207                        16EA5F
  -1140  t_new                0x207                        16EA5F

 0016E9E8  00048361   NCFTP     0001:00038361  SWrite.c#65 _SWrite + 191 0001:000381D0 (SWrite.obj)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     sfd                  32 bit signed                5
   12    buf0                 8 bit unsigned               16EBC0
   16    size                 32 bit unsigned              6
   20    tlen                 32 bit signed                3
   24    swopts               32 bit signed                0
  -276   now                  32 bit signed                0
  -264   ss                   0x203                        0
  -272   tv                   0x207                        0

 0016EB58  0003628E   NCFTP     0001:0002628E  rcmd.c#367 _FTPSendCommandStr + 10E 0001:00026180 (rcmd.obj)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     cip                  0x0                          63460
   12    command              pointer to 8 bit unsigned    16EBC0
   16    siz                  32 bit unsigned              200

 0016EBA8  0003636B   NCFTP     0001:0002636B  rcmd.c#385 _FTPSendCommand + 4B 0001:00026320 (rcmd.obj)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     cip                  0x0                          63460
   12    cmdspec              8 bit unsigned               3C056
   16    ap                   pointer to 8 bit unsigned    16EE0C
  -520   command              0x21C                        54495551

 0016EDC8  000365DC   NCFTP     0001:000265DC  rcmd.c#509 _RCmd + 3C 0001:000265A0 (rcmd.obj)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     cip                  0x0                          63460
   12    rp                   pointer to type 0x203        20044620
   16    cmdspec              8 bit unsigned               3C056

 0016EDF8  0003C165   NCFTP     0001:0002C165  open.c#654 _FTPCloseHost + 105 0001:0002C060 (open.obj)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     cip                  pointer to type 0x204        63460

 0016EE28  0001EA3C   NCFTP     0001:0000EA3C  main.c#164 _CloseHost + 3C 0001:0000EA00 (main.c)

 0016EE48  00020355   NCFTP     0001:00010355  shell.c#650 _CommandShell + 3B5 0001:0000FFA0 (shell.c)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
  -4104  ai                   0x21C                        0
  -4168  prompt               0x225                        16EF57
  -4172  cmdStop              32 bit signed                0

 0016FEF8  0001F29B   NCFTP     0001:0000F29B  main.c#383 main + 5CB 0001:0000ECD0 (main.c)

  Offset Name                 Type                         Hex Value
  ────── ──────────────────── ──────────────────────────── ─────────
   8     argc                 32 bit signed                1
   12    argv                 pointer to 8 bit unsigned    16FFA4
   40    opt                  0x220                        1CBD0E81

 0016FF60  00010047   NCFTP     0001:00000047  crt0.s#90 __text + 47 0001:00000000 (D:\Temp\ccxJEDJD.s)

 0016FF84  1CBD0E81   LIBCX0    0001:00010E81   ___init_app + 11 0001:00010E70 (main.obj)

 0016FFE0  1F3C45BB   LIBCN0    0001:000345BB  appinit.s#16 ___init_app + B 0001:000345B0 (appinit.obj)

______________________________________________________________________

 Labels on the Stack
______________________________________________________________________

   ESP     Address    Module     Obj:Offset    Nearest Public Symbol
 --------  ---------  --------  -------------  -----------------------
 0016E51C  1F3E988C   LIBCN0    0001:0005988C  __write.c#70 ___write + DC 0001:000597B0 (__write.obj)
 0016E58C  1F3FBD55   LIBCN0    0001:0006BD55  _output.c#460 __output - 18F 0001:0006BEE4 (_output.obj)
 0016E5AC  00036144   NCFTP     0001:00026144  rcmd.c#204 _GetResponse + 3C4 0001:00025D80 (rcmd.obj)
 0016E5BC  1F3FC93F   LIBCN0    0001:0006C93F  _output.c#1255 __output + A5B 0001:0006BEE4 (_output.obj)
 0016E9EC  00048361   NCFTP     0001:00038361  SWrite.c#65 _SWrite + 191 0001:000381D0 (SWrite.obj)
 0016EA2C  0001F640   NCFTP     0001:0000F640  shell.c#481 _BackToTop 0001:0000F640 (shell.c)
 0016EB44  0003C056   NCFTP     0001:0002C056  open.c#584 _FTPQueryFeatures + 696 0001:0002B9C0 (open.obj)
 0016EB5C  0003628E   NCFTP     0001:0002628E  rcmd.c#367 _FTPSendCommandStr + 10E 0001:00026180 (rcmd.obj)
 0016EB98  1F39B187   LIBCN0    0001:0000B187  fmutex.c#455 ___fmutex_release_internal + 4F 0001:0000B138 (D:\Users\dmik\rpmbuild\BUILD\libc-0.1.8\src\emx\src\lib\process\fmutex.c)
 0016EBA4  00036383   NCFTP     0001:00026383  rcmd.c#385 _FTPSendCommand + 63 0001:00026320 (rcmd.obj)
 0016EBAC  0003636B   NCFTP     0001:0002636B  rcmd.c#385 _FTPSendCommand + 4B 0001:00026320 (rcmd.obj)
 0016EBCC  00033948   NCFTP     0001:00023948  u_localtime.c#32 _Localtime + 88 0001:000238C0 (u_localtime.obj)
 0016EBEC  0002983D   NCFTP     0001:0001983D  trace.c#62 _Trace + AD 0001:00019790 (trace.c)
 0016EBF4  00029778   NCFTP     0001:00019778  trace.c#77 _ErrorHook + 18 0001:00019760 (trace.c)
 0016EC5C  0002C34A   NCFTP     0001:0001C34A  gl_getline.c#630 _old_termios + 16D1A 0002:00005630 (gl_getline.c)
 0016EC7C  0002F170   NCFTP     0001:0001F170  gl_getline.c#937 _gl_getline + 1080 0001:0001E0F0 (gl_getline.c)
 0016EC80  0001F640   NCFTP     0001:0000F640  shell.c#481 _BackToTop 0001:0000F640 (shell.c)
 0016EC94  000218F2   NCFTP     0001:000118F2  readln.c#488 _gXtermTitle + CF62 0002:00004990 (readln.c)
 0016EC9C  1F3FBD55   LIBCN0    0001:0006BD55  _output.c#460 __output - 18F 0001:0006BEE4 (_output.obj)
 0016ECBC  1F39E1F2   LIBCN0    0001:0000E1F2  ialloc.c#201 __um_lump_alloc - 3DE 0001:0000E5D0 (D:\Users\dmik\rpmbuild\BUILD\libc-0.1.8\src\emx\src\lib\malloc\ialloc.c)
 0016ED1C  1F39E80C   LIBCN0    0001:0000E80C  ialloc.c#296 __um_alloc_no_lock + 184 0001:0000E688 (D:\Users\dmik\rpmbuild\BUILD\libc-0.1.8\src\emx\src\lib\malloc\ialloc.c)
 0016ED6C  1F3A136D   LIBCN0    0001:0001136D  fmutex.h#138 __ucalloc + 95 0001:000112D8 (D:\Users\dmik\rpmbuild\BUILD\libc-0.1.8\src\emx\src\lib\malloc\ucalloc.c)
 0016EDAC  1F4006CE   LIBCN0    0001:000706CE  calloc.c#26 __std_calloc + 2E 0001:000706A0 (calloc.obj)
 0016EDCC  000365DC   NCFTP     0001:000265DC  rcmd.c#509 _RCmd + 3C 0001:000265A0 (rcmd.obj)
 0016EDD4  0003C056   NCFTP     0001:0002C056  open.c#584 _FTPQueryFeatures + 696 0001:0002B9C0 (open.obj)
 0016EDDC  1F42144B   LIBCN0    0001:0009144B  ifree.c#150 __um_free_maybe_lock + 7F 0001:000913CC (ifree.obj)
 0016EDFC  0003C165   NCFTP     0001:0002C165  open.c#654 _FTPCloseHost + 105 0001:0002C060 (open.obj)
 0016EE08  0003C056   NCFTP     0001:0002C056  open.c#584 _FTPQueryFeatures + 696 0001:0002B9C0 (open.obj)
 0016EE0C  0002DE5B   NCFTP     0001:0001DE5B  gl_getline.c#1558 _gl_histadd + 1DB 0001:0001DC80 (gl_getline.c)
 0016EE2C  0001EA3C   NCFTP     0001:0000EA3C  main.c#164 _CloseHost + 3C 0001:0000EA00 (main.c)
 0016EE4C  00020355   NCFTP     0001:00010355  shell.c#650 _CommandShell + 3B5 0001:0000FFA0 (shell.c)
 0016EEB4  1FA60D64   TCPIP32   0001:00000D64  between j_Dos32FlatToSel + 32C and __dofmto - A3C
 0016FEE8  0001FFB0   NCFTP     0001:0000FFB0  shell.c#545 _CommandShell + 10 0001:0000FFA0 (shell.c)
 0016FEF4  0001EA67   NCFTP     0001:0000EA67  main.c#158 _CloseHost + 67 0001:0000EA00 (main.c)
 0016FEFC  0001F29B   NCFTP     0001:0000F29B  main.c#383 main + 5CB 0001:0000ECD0 (main.c)
 0016FF04  0001EAF4   NCFTP     0001:0000EAF4  main.c#158 _CloseHost + F4 0001:0000EA00 (main.c)
 0016FF14  0001EA5E   NCFTP     0001:0000EA5E  main.c#158 _CloseHost + 5E 0001:0000EA00 (main.c)
 0016FF1C  1CBD0A90   LIBCX0    0001:00010A90  main.c#152 libcxExceptionHandler - 10 0001:00010AA0 (D:\Users\dmik\rpmbuild\BUILD\libcx-0.7.1\src\main.c)
 0016FF64  00010047   NCFTP     0001:00000047  crt0.s#90 __text + 47 0001:00000000 (D:\Temp\ccxJEDJD.s)
 0016FF78  1CBD0AA0   LIBCX0    0001:00010AA0  main.c#80 libcxExceptionHandler 0001:00010AA0 (D:\Users\dmik\rpmbuild\BUILD\libcx-0.7.1\src\main.c)
 0016FF88  1CBD0E81   LIBCX0    0001:00010E81   ___init_app + 11 0001:00010E70 (main.obj)
 0016FFA0  1F3F9A70   LIBCN0    0001:00069A70  exceptions.c#74 __libc_Back_exceptionHandler 0001:00069A70 (exceptions.obj)
 0016FFC4  1F3AAB84   LIBCN0    0001:0001AB84  __init.c#307 ___init + 64 0001:0001AB20 (D:\Users\dmik\rpmbuild\BUILD\libc-0.1.8\src\emx\src\lib\sys\__init.c)
 0016FFE4  1F3C45BB   LIBCN0    0001:000345BB  appinit.s#16 ___init_app + B 0001:000345B0 (appinit.obj)
 0016FFEC  1FFECE38   DOSCALL1  0004:0000CE38  DOS32R3EXITADDR

______________________________________________________________________

 Stack Contents from ESP-100 to Stack Base  (ESP = 0016E500)
______________________________________________________________________

 --addr--   --------------dwords---------------   -----chars------
 0016E400 : 00000000 0000B39E 00000000 00000000 : ................
 0016E410 : FFFF0000 01830000 00000000 00000000 : ................
 0016E420 : 00000000 00000000 00000000 00000000 : ................
 0016E430 : 20200000 00004020 00000000 00000000 : ..   @..........
 0016E440 : 00000000 0000150B 00000053 00000053 : ........S...S...
 0016E450 : 00000000 00000005 00000000 0016EA40 : ............@...
 0016E460 : 00000000 00000001 0016E9E8 1CBC313C : ............<1..
 0016E470 : 0000005B 00010246 0016E500 00000053 : [...F.......S...
 0016E480 : 00000000 0016E7D0 0016E4F8 1F3E6D6B : ............km>.
 0016E490 : 00000006 00000000 0016E7D0 00000000 : ................
 0016E4A0 : 0016EA38 0016E4D4 00000A54 1F3A0E0C : 8.......T.....:.
 0016E4B0 : 1B076E50 00000000 000E0002 00000001 : Pn..............
 0016E4C0 : 00000004 00000000 00000000 00000005 : ................
 0016E4D0 : 20042A40 FFFFFFFF 00000000 148000AD : @*. ............
 0016E4E0 : DDDF02FA 00000091 00B7E458 0016EA40 : ........X...@...
 0016E4F0 : 00000000 00000000 0016E9E8 1CBC302F : ............/0..
 0016E500 : 00000006 00000000 0016E7D0 00000000 : ................
 0016E510 : 0016EA38 0016EA5F 0016E578 1F3E988C : 8..._...x.....>.
 0016E520 : 00000003 0016E5B0 00000002 FFFFFFFF : ................
 0016E530 : 0016EA40 00000003 00000000 0016E7D0 : @...............
 0016E540 : 00000000 00000000 00000005 00000005 : ................
 0016E550 : 0AB50000 00000002 0000150B 0000037F : ................
 0016E560 : 00000000 14900000 0016EBC4 0016E624 : ............$...
 0016E570 : 00000002 0016EA5F 0016E9C8 00000004 : ...._...........
 0016E580 : 0016E624 0016EBC0 0016E5B8 1F3FBD55 : $...........U.?.
 0016E590 : 00000004 00000000 0016E5B0 00000003 : ................
 0016E5A0 : 00000002 00000001 00000001 00036144 : ............Da..
 0016E5B0 : 0016E624 00000000 0016E658 1F3FC93F : $.......X...?.?.
 0016E5C0 : 0000000A 00000000 00000000 00000000 : ................
 0016E5D0 : 00000000 00000000 00000000 00000000 : ................
 0016E7C0 : 31 lines not printed duplicate the line above
 0016E7D0 : 00000020 00000000 00000000 00000000 :  ...............
 0016E7E0 : 00000000 00000000 00000000 00000000 : ................
 0016E9C0 : 30 lines not printed duplicate the line above
 0016E9D0 : 6121BC83 000001D8 000001E0 0016EA40 : ..!a........@...
 0016E9E0 : 00000006 00000020 0016EB58 00048361 : .... ...X...a...
 0016E9F0 : 00000006 00000000 0016EA40 00000000 : ........@.......
 0016EA00 : 0016EA38 0016EA5F 00000001 000E0002 : 8..._...........
 0016EA10 : 00000002 00000000 00000006 00000020 : ............ ...
 0016EA20 : 00000000 0016EBC0 6121BC86 0001F640 : ..........!a@...
 0016EA30 : 00000003 6121BC83 00000003 00000000 : ......!a........
 0016EA40 : 00000020 00000000 00000000 00000000 :  ...............
 0016EA50 : 00000000 00000000 00000000 00000000 : ................
 0016EB30 : 14 lines not printed duplicate the line above
 0016EB40 : 0016EB5C 0003C056 0016EE0C 00063460 : \...V.......`4..
 0016EB50 : 0016EBC0 FFFFFFFF 0016EBA8 0003628E : .............b..
 0016EB60 : 00000005 0016EBC0 00000006 00000003 : ................
 0016EB70 : 00000000 00001182 000001FF 00000020 : ............ ...
 0016EB80 : 00000000 000000FF 00000000 0016EBC4 : ................
 0016EB90 : 00160401 00000000 1F39B187 0016EBC0 : ..........9.....
 0016EBA0 : 0006346F 00036383 0016EDC8 0003636B : o4...c......kc..
 0016EBB0 : 00063460 0016EBC0 00000200 0016EE0C : `4..............
 0016EBC0 : 54495551 00000A0D 0016EBE8 00033948 : QUIT........H9..
 0016EBD0 : 0016EBF0 0016EC1C 000001E0 00000000 : ................
 0016EBE0 : 0016EC40 00000040 0016EE48 0002983D : @...@...H...=...
 0016EBF0 : 1B0790E4 00029778 00000013 00000036 : ....x.......6...
 0016EC00 : 0000003B 0016EC40 00000000 1B076950 : ;...@.......Pi..
 0016EC10 : 00000001 00000001 0016EC48 0000003B : ........H...;...
 0016EC20 : 00000036 00000013 00000015 00000007 : 6...............
 0016EC30 : 00000079 00000006 000000E8 00000001 : y...............
 0016EC40 : 7962203E 000A0A65 0016EC78 00000003 : > bye...x.......
 0016EC50 : 00000003 00000000 0016EC78 0002C34A : ........x...J...
 0016EC60 : 00000000 00000009 00065630 0D000003 : ........0V......
 0016EC70 : 00000003 00000003 0016EE28 0002F170 : ........(...p...
 0016EC80 : 0001F640 00000000 00000000 00000000 : @...............
 0016EC90 : 0016ED34 000218F2 0016ECC8 1F3FBD55 : 4...........U.?.
 0016ECA0 : 00000000 00000002 0016EE48 00000000 : ........H.......
 0016ECB0 : 20044618 20030150 20030150 1F39E1F2 : .F. P.. P.. ..9.
 0016ECC0 : 20044620 00000020 20030150 00000020 :  F.  ...P..  ...
 0016ECD0 : 00000000 00000000 00000000 00000010 : ................
 0016ECE0 : 00000001 00000000 20030000 20044620 : ...........  F. 
 0016ECF0 : 00000060 00000040 00000020 20044620 : `...@... ... F. 
 0016ED00 : 01010100 01010101 01000101 20030000 : ............... 
 0016ED10 : 00000020 00000040 0016ED68 1F39E80C :  ...@...h.....9.
 0016ED20 : 00000002 01010101 01010101 01010101 : ................
 0016ED30 : 01010101 00000004 00000003 00000004 : ................
 0016ED40 : 01010101 01010101 00000002 00000010 : ................
 0016ED50 : 00000004 00000000 0016EDA8 20030000 : ............... 
 0016ED60 : 00000010 2003013C 0016EDA8 1F3A136D : ....<.. ....m.:.
 0016ED70 : 20030000 00000020 00000010 00000002 : ...  ...........
 0016ED80 : 01010101 200300EC 00000000 B39E0000 : ....... ........
 0016ED90 : 20044640 20030000 0016EDE8 00063460 : @F. ... ....`4..
 0016EDA0 : 00000000 00000000 0016EDC8 1F4006CE : ..............@.
 0016EDB0 : 20030000 00000001 00000020 009E0000 : ... .... .......
 0016EDC0 : 01010101 00063460 0016EDF8 000365DC : ....`4.......e..
 0016EDD0 : 00063460 0003C056 0016EE0C 1F42144B : `4..V.......K.B.
 0016EDE0 : 20038600 200386F0 00000001 00063460 : ... ... ....`4..
 0016EDF0 : 00000000 20044620 0016EE28 0003C165 : .... F. (...e...
 0016EE00 : 00063460 20044620 0003C056 0002DE5B : `4.. F. V...[...
 0016EE10 : 20044640 200386F8 00000003 00000001 : @F. ... ........
 0016EE20 : 00000000 00000000 0016EE48 0001EA3C : ........H...<...
 0016EE30 : 00063460 00000001 000001E0 00000004 : `4..............
 0016EE40 : 00000000 00000000 0016FEF8 00020355 : ............U...
 0016EE50 : 200386F8 0016F2E0 0016EEE0 00000100 : ... ............
 0016EE60 : 0016F6E0 00000800 0016F2E4 00000000 : ................
 0016EE70 : 00000000 4B4A4948 4F4E4D4C 53525150 : ....HIJKLMNOPQRS
 0016EE80 : 57565554 625A5958 00000000 200386F8 : TUVWXYZb....... 
 0016EE90 : 67666564 6B6A6968 6F6E6D6C 6121BC83 : defghijklmno..!a
 0016EEA0 : 7466636E 202F2070 7F00203E 00000000 : ncftp / > ......
 0016EEB0 : 0016EF57 1FA60D64 8B8A8988 8F8E8D8C : W...d...........
 0016EEC0 : 93929190 00000002 0016EB38 0000000C : ........8.......
 0016EED0 : 00000002 0016EC3C 00000002 00000002 : ....<...........
 0016EEE0 : 00000000 00000000 00000000 00000000 : ................
 0016FED0 : 255 lines not printed duplicate the line above
 0016FEE0 : 0000109C 000001A2 0001FFB0 00000001 : ................
 0016FEF0 : 0016FF38 0001EA67 0016FF60 0001F29B : 8...g...`.......
 0016FF00 : 00000000 0001EAF4 00065320 00000000 : ........ S......
 0016FF10 : 00065300 0001EA5E 00000015 1CBD0A90 : .S..^...........
 0016FF20 : 00000000 00000010 0016FF90 00000000 : ................
 0016FF30 : 0016FF90 0016FF84 F123456F 00000000 : ........oE#.....
 0016FF40 : 00000001 00000000 00000000 00000000 : ................
 0016FF50 : 00000000 0016FF90 00000000 00000000 : ................
 0016FF60 : 0016FF84 00010047 00000001 0016FFA4 : ....G...........
 0016FF70 : 20030180 0016FF9C 1CBD0AA0 00000000 : ... ............
 0016FF80 : 0016FFE0 0016FFE0 1CBD0E81 0016FF90 : ................
 0016FF90 : 00000001 0016FFA4 20030180 FFFFFFFF : ........... ....
 0016FFA0 : 1F3F9A70 0016FFAD 00000000 66636E80 : p.?..........ncf
 0016FFB0 : 1F007074 00000000 00000000 00000040 : tp..........@...
 0016FFC0 : 00000020 1F3AAB84 00000001 00000000 :  .....:.........
 0016FFD0 : 00000000 00000000 00000000 00000000 : ................
 0016FFE0 : 00000000 1F3C45BB 00000001 1FFECE38 : .....E<.....8...
 0016FFF0 : 0000124C 00000000 00170000 00170F76 : L...........v...

______________________________________________________________________

 Memory addressed by EBX (0016EA40) for 256 bytes
______________________________________________________________________

 --addr--   -----dwords------   ---------bytes---------   -chars--
 0016EA40 : 00000020 00000000 : 20 00 00 00 00 00 00 00 :  .......
 0016EA48 : 00000000 00000000 : 00 00 00 00 00 00 00 00 : ........
 0016EB38 : 30 lines not printed duplicate the line above

______________________________________________________________________

 DLLs accessible from this process
______________________________________________________________________

 DOSCALLS                   06/15/2021 16:58:09    870,886 W:\OS2KRNL
 DISTORM  14730000 0000a274 11/11/2012 21:43:02     57,491 W:\USR\LIB\DISTORM.DLL
 EXCEPTQ  14c10000 000136c6 06/01/2020 18:37:01    162,595 W:\USR\LIB\EXCEPTQ.DLL
 PMMERGE  193a0000 00002000 04/10/2007 18:26:01  1,270,275 W:\OS2\DLL\PMMERGE.DLL
 PMGPI    1b730000 00010000 10/16/2001 13:31:09    248,446 W:\OS2\DLL\PMGPI.DLL
 LIBCX0   1cbc0000 000145d0 08/16/2021 14:09:29     65,099 W:\USR\LIB\LIBCX0.DLL
 VBE2GRAD 1f070000 000048f0 10/31/2020 11:14:21     65,425 W:\OS2\DLL\VBE2GRAD.DLL
 PANOGREX 1f090000 0000030d 10/31/2020 11:14:09      2,041 W:\OS2\DLL\PANOGREX.DLL
 VMAN     1f0a0000 0000d9f9 03/22/2006 14:20:26     67,993 W:\OS2\DLL\VMAN.DLL
 GRE2VMAN 1f0f0000 000044a8 01/20/2020 09:00:12     21,325 W:\OS2\DLL\GRE2VMAN.DLL
 FREETYPE 1f190000 0001729c 03/23/2020 20:38:23     82,402 W:\OS2\DLL\FREETYPE.DLL
 PMUNIF   1f1c0000 0000c3a0 10/16/2001 14:59:29     43,823 W:\OS2\DLL\PMUNIF.DLL
 PMATM    1f1e0000 0003bd25 09/14/2001 15:41:26    224,343 W:\OS2\DLL\PMATM.DLL
 DISPLAY  1f240000 0000004c 03/22/2006 08:54:14     44,198 W:\OS2\DLL\DISPLAY.DLL
 BVHWNDW  1f310000 00004316 09/10/2001 16:17:17     16,797 W:\OS2\DLL\BVHWNDW.DLL
 LOCALE   1f320000 00025fd0 09/04/2002 17:31:00    108,353 W:\OS2\DLL\LOCALE.DLL
 LIBC066  1f350000 0002f2c0 08/16/2021 13:56:16    316,306 W:\USR\LIB\LIBC066.DLL
 PREWRITE 1f380000 00001e00 01/20/2020 06:47:00     11,521 W:\SYS\DLL\PREWRITE.DLL
 LIBCN0   1f390000 0010da70 08/16/2021 13:56:17  1,225,146 W:\USR\LIB\LIBCN0.DLL
 LIBUNI   1f5f0000 00012b9c 01/20/2020 07:34:15     80,766 W:\OS2\DLL\LIBUNI.DLL
 GCC1     1f7d0000 00015760 07/22/2020 20:36:12     65,864 W:\USR\LIB\GCC1.DLL
 SPL1B    1f810000 00000822 01/18/2005 13:37:00      7,125 W:\OS2\DLL\SPL1B.DLL
 SOFTDRAW 1f820000 000c5a96 12/29/2004 11:15:00    417,095 W:\OS2\DLL\SOFTDRAW.DLL
 TCPIP32  1fa60000 0001bb20 08/16/2011 09:01:00     87,504 W:\MPTN\DLL\TCPIP32.DLL
 PMSHLTKT 1fa90000 0000e000 09/06/2000 12:45:10     44,232 W:\OS2\DLL\PMSHLTKT.DLL
 UCV32    1faa0000 00005c91 09/04/2002 22:30:00     27,463 W:\OS2\DLL\UCV32.DLL
 UCONV    1fac0000 0000024f 01/20/2020 07:34:15      1,682 W:\OS2\DLL\UCONV.DLL
 PMVIOP   1fad0000 0000e204 12/29/2004 11:46:00     66,820 W:\OS2\DLL\PMVIOP.DLL
 PMSPL    1fb60000 00006a46 01/18/2005 13:37:00    280,283 W:\OS2\DLL\PMSPL.DLL
 FFST     1ff20000 00002234 03/08/2002 18:23:00     11,425 W:\OS2\DLL\FFST.DLL
 DOSCALL1 1ffc0000 0000c1f4 11/24/2011 03:24:00    132,401 W:\OS2\DLL\DOSCALL1.DLL

______________________________________________________________________

 End of Exception Report - report took 338 ms to generate
______________________________________________________________________

Sorry if this is the wrong place to post this, as the issue appeared after updating libcx, it seems to be a libcx issue.

LewisR commented 3 years ago

I should add that when I attempted to force the situation, I terminated the FTP connection on the server side without first downloading a file, but exiting did not trigger the trap. It appears that a transfer must have first taken place (in my case, I was only uploading files and the connection timed out overnight). Exiting ncFTP by typing "exit" at the program's prompt generated the trap.

dmik commented 3 years ago

Looks like a regression of 99f3976c3f55464be2c088c023854de98ce98695 (ponters not checked for NULL). I cannot reproduce it t (you didn't provide any working FTP link and I don't have one) but it should be easy to fix. Please try http://rpm.netlabs.org/test/libcx0.7z.

dryeo commented 3 years ago

This seems to work. Tested on ftp.arcanoae.com and a locally running ftpser.

ncftp / > bye
*** ENOTSOCK, retrying (attempts left 2)
*** ENOTSOCK, retrying (attempts left 1)
*** ENOTSOCK, retrying (attempts left 0)
Could not write to control stream: Socket operation on non-socket.

Thanks

dmik commented 3 years ago

Ok, good. I wonder why it can not write to the socket. Was this error present before (note that *** are debug lines, won't be part of the release build)? Might be some other TCP/IP for OS/2 speciality...

LewisR commented 3 years ago

The socket issue is because the FTP connection has timed out on the server side. I tried to test this again, but forcing the server to close the connection did not produce the trap, and on my server, timeout is excessively long, making quick testing rather difficult. I'm glad that Dave was able to get his to choke(!) sooner. :-)

Thanks for the quick fix!

LewisR commented 3 years ago

I should add that ncFTP has always advised of a failed write attempt to a non-socket. It's just that after that, it would exit cleanly without the trap. Maybe that's just ncFTP being more verbose in its reporting than necessary when trying to close the connection.

StevenLevine commented 3 years ago

My guess is that the timeout cleanup is not quite right. The ENOTSOCK is probably because ncFTP closed the socket in response to the timeout, but neglected to update the lists it uses to prepare the fd_sets passed to select.

It also not clear why ncFTP needs to do a select in response to a bye when there are no more connections to process.

dryeo commented 3 years ago

@dmik, previously ncftp did not post the ENOTSOCK lines, just the control stream line, guess a slightly different code path now that ENOTSOCK is returned.

@steven, ncftp doesn't know the connection has timed out till it tries to close the already closed connection. Another point is the previous trap only seemed to happen if a file was transferred, perhaps causing more sockets to be open.

LewisR commented 3 years ago

I always thought that the ENOTSOCK was because ncFTP does not check the state of the socket first, before attempting shutdown(). It might be worthwhile to set an explicit value for control-timeout in the config file, but there is really no way for the client to know what the server's timeout setting may be. This option (control-timeout) tells ncFTP to consider the connection dropped if no data has been received over the control channel in that amount of time. I guess it defaults to forever, which is probably safe - except for this noise upon exit, where the client onsiders the connection still valid. Anyway, we can discuss ncFTP's quirks in a more appropriate venue. :-)