Hi Ezra,
I don’t understand this part in your test code:
(usocket:socket-send socket (userial:make-buffer) 32768 :host remote-host :port remote-port)
What’s done by (userial:make-buffer) is a empty buffer, but you send its contents as a message length of 32768. USOCKET passed the created array directly to underlying SB-BSD-SOCKETS:SOCKET-SEND in this case, but I think SBCL actually didn’t allocate any memory, so there’s a memory access issue when it trys to find the 32768 elements.
Here is the definition of USERIAL:MAKE-BUFFER:
(defun make-buffer (&optional (initial-capacity +default-buffer-capacity+)) "Create an empty BUFFER of a given INITIAL-CAPACITY" (declare (type bufsize initial-capacity) (optimize (speed 3))) (make-array (list initial-capacity) :element-type 'uchar :initial-element 0 :fill-pointer 0 :adjustable t))
I think SBCL has its reason to optimize above calls by not allocating any memory until you start to push the first element in. Maybe SBCL only does it when seeing (optimize (speed 3)), I don’t know...
Any way, I can’t say this is either an issue of USERIAL, USOCKET or SBCL, because each of them didn’t do anything unreasonable here…
Hope this helps,
Chun
Il giorno 27/gen/2015, alle ore 23:19, Ezra Rush notifications@github.com ha scritto:
I apologize if this is actually an issue with userial or Windows.
Code can be found here: https://gist.github.com/ezrarush/01741135c7141621210c
Using userial with usocket's datagram socket causes an intermittent error.
Socket error in "sendto": 10014 (The system detected an invalid pointer address in attempting to use a pointer argument in a call.) [Condition of type SB-BSD-SOCKETS:SOCKET-ERROR]
Using an array instead of userial's buffer does not seem to error.
— Reply to this email directly or view it on GitHub.