Opened 11 years ago

Closed 11 years ago

#368 closed defect (fixed)

Cannot make datagram socket

Reported by: binghe Owned by: gb
Priority: major Milestone: IA-32 port
Component: Compiler Version: trunk
Keywords: socket Cc:

Description

Open a unconnected UDP (datagram, internet) socket failed on CCL trunk darwinX8632. (darwinX8664 is OK)

Welcome to Clozure Common Lisp Version 1.3-dev-r11173M-trunk  (DarwinX8632)!
? (openmcl-socket:make-socket :address-family :internet
					  :type :datagram)
> Error: value NIL is not of the expected type (OR INTEGER STRING).
> While executing: CCL::HOST-AS-INET-HOST, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :b  
 (454C2C) : 0 (HOST-AS-INET-HOST NIL) 1199
 (454C38) : 1 (MAKE-TCP-STREAM-SOCKET
                4
                :ADDRESS-FAMILY
                :INTERNET
                :TYPE
                :DATAGRAM) 359
 (454C78) : 2 (MAKE-TCP-SOCKET :ADDRESS-FAMILY :INTERNET :TYPE :DATAGRAM) 503
 (454CAC) : 3 (MAKE-SOCKET :ADDRESS-FAMILY :INTERNET :TYPE :DATAGRAM) 695
 (454DA0) : 4 (CALL-CHECK-REGS
                MAKE-SOCKET
                :ADDRESS-FAMILY
                :INTERNET
                :TYPE
                :DATAGRAM) 247
 (454DBC) : 5 (TOPLEVEL-EVAL
                (MAKE-SOCKET :ADDRESS-FAMILY :INTERNET :TYPE :DATAGRAM)
                NIL) 759
 (454DFC) : 6 (READ-LOOP :INPUT-STREAM
                         #<SYNONYM-STREAM to *TERMINAL-IO* #x891D4C6>
                         :OUTPUT-STREAM
                         #<SYNONYM-STREAM to *TERMINAL-IO* #x891D3EE>
                         :BREAK-LEVEL
                         0
                         :PROMPT-FUNCTION
                         #<Compiled-function (:INTERNAL CCL::READ-LOOP) (Non-Global)  #x834F0CE>) 1567
 (454F00) : 7 (TOPLEVEL-LOOP) 79
 (454F08) : 8 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 87
 (454F14) : 9 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>) 583
 (454F60) : 10 (RUN-PROCESS-INITIAL-FORM
                 #<TTY-LISTENER listener(1) [Active] #x891C886>
                 (#<COMPILED-LEXICAL-CLOSURE # #x891C5A6>)) 671
 (454FA4) : 11 (FUNCALL #'#<(:INTERNAL CCL::%PROCESS-PRESET-INTERNAL)>
                        #<TTY-LISTENER listener(1) [Active] #x891C886>
                        (#<COMPILED-LEXICAL-CLOSURE # #x891C5A6>)) 335
 (454FCC) : 12 (FUNCALL #'#<(:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 279

Change History (6)

comment:1 Changed 11 years ago by binghe

MAKE-SOCKET should call MAKE-IP-SOCKET then MAKE-UDP-SOCKET when given (:ADDRESS-FAMILY :INTERNET) and (:TYPE :DATAGRAM), but MAKE-TCP-SOCKET be called here.

I don't know why, looking into #p"level-1/l1-sockets.lisp" doesn't help.

Hope you guys can find out the reason.

comment:2 Changed 11 years ago by gb

  • Status changed from new to assigned

This seems to be a problem with function inlining and keyword arguments on x8632.

As a workaround (until that problem's fixed), if you change the

(declaim (inline make-ip-socket))

to

(declaim (notinline make-ip-socket))

in level-1/l1-sockets.lisp and rebuild, I'd bet that it'll behave correctly.

comment:3 Changed 11 years ago by binghe

Thanks for finding out the reason. Your "notinline" workaround works, and now I can make-socket on ccl32 correctly!

Before I go to write this whole ticket, I tried to just put a #+ignore before the declaim form, but nothing changed, and MAKE-IP-SOCKET still inline... strange, is "inline" the default option on such cases?

comment:4 Changed 11 years ago by gb

  • Component changed from Runtime (threads, GC) to Compiler

No. The (DECLAIM (INLINE ...)) was still in effect in the running lisp, even after it'd been commented out in the file.

CLtL2 defined a function named FUNCTION-INFORMATION that didn't make it into ANSI CL (because a few related functions were incompletely specified.) FUNCTION-INFORMATION is still defined in the CCL package:

? (ccl:function-information 'ccl::make-ip-socket nil)
:FUNCTION                ; CCL::MAKE-IP-SOCKET is a globally-defined function
NIL                      ; defined in a null lexical environment
((INLINE . INLINE))      ; info about declarations in effect in the specified environment

That's globally in effect (in the null environment) because when the image was built, we loaded a file (the fasl for l1-sockets) that put it in effect and nothing's overriding it. If you had commented the (DECLAIM (INLINE ...)) form out and rebuilt the lisp, there would not have been a global inline proclamation in effect in the resulting image, and if you'd compiled l1-sockets again in that image the calls wouldn't have been inlined.

comment:5 Changed 11 years ago by binghe

Thanks for the explanation, this help me a lot. When generating loadable lisp patch, I should also handle this inline issue as you suggested.

comment:6 Changed 11 years ago by rme

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.