Martin Elster | 2 Apr 2005 15:37

method names for already existing functions

Greetings,

Sometimes I forget not to call accessor methods FORMAT, TYPE etc.

 > (defclass foo ()
	((format :accessor format)))
Error: "FORMAT already names an ordinary function or a macro.".
 > (defclass foo ()
	((file-format :accessor file-format)))
Error: "FORMAT already names an ordinary function or a macro.".

I expected my redefinition to work, but apparently it doesn't. Is this
a bug, or just a case of "Don't do that then"?

Also, on a similar note,

 > (defclass bar ()
	((type :accessor type)))
debugger invoked on a SYMBOL-PACKAGE-LOCKED-ERROR in thread 20039:
   Lock on package COMMON-LISP violated when setting fdefinition of TYPE.
   [....]
restarts (invokable by number or by possibly-abbreviated name):
   0: [CONTINUE      ] Ignore the package lock.
   1: [IGNORE-ALL    ] Ignore all package locks in the context of this 
operation.
   2: [UNLOCK-PACKAGE] Unlock the package.
   3: [ABORT         ] Reduce debugger level (leaving debugger, returning to
                       toplevel).
   4: [TOPLEVEL      ] Restart at toplevel READ/EVAL/PRINT loop.
 >:ABORT
(Continue reading)

Robert Marlow | 4 Apr 2005 10:39

Any SBCL developers want some work?

My employer's getting impatient with my having to hold back our project
due to threading issues in SBCL. They're willing to hire on a developer
to help fix them within the next few weeks. Any takers?

Basically just fixing threading issues I haven't been able to figure
out. I'm fairly certain they're mostly threading issues within SBCL
itself which I haven't been able to fully diagnose, though some may be
due to CLSQL not playing nicely with SBCL.

If anyone's interested, email me at r.marlow (at) piscescom (dot) com .

--

-- 
Robert Marlow <bobstopper <at> bobturf.org>

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Gábor Melis | 4 Apr 2005 17:34

Re: Oddity with make-thread and sleep.

On Tuesday 22 March 2005 14:51, Sean Ross wrote:
>  Running sleep on it's own does what is expected but when
>  run in conjunction with make-thread it returns instantly.
>
>  This seems to be caused by the call to select getting interrupted at
>  some point. Replacing sleep with
>  (multiple-value-list (sb-unix:unix-select 0 0 0 0 1 0))
>  seems to bear this out, although where it happens though is beyond me.

It is SIG_THREAD_EXIT signaled by the child on exit that interrupts the select 
call. A gc triggered in another thread also interrupts sleep and these system 
calls are not restarted automatically.

The attached patch implements sleep with nanosleep, calling it again when 
necessary.

Cheers, Gabor

>
>
>  Regards,
>    Sean.
Attachment (sleep.patch): text/x-diff, 2510 bytes
Gábor Melis | 4 Apr 2005 18:00

Re: threads, streams, memory leak?

I've found a message describing the exact same problem:
http://article.gmane.org/gmane.lisp.steel-bank.devel/1879

SBCL allocates two buffers on the wrong thread (accept), and never calls 
deallocate-system-memory when the thread exits, so not even restarting the 
server can discard the accumulated buffers.

Some measurements were conducted on sbcl 0.8.21 with the attached program 
against apache bench. GC was turned off.

/usr/sbin/ab -n 10000 -c 64 http://localhost:2002/

concurrency       |     1        8         64
------------------------------------------------
without patches   | 6.988660  6.779214  6.736636
B Downing's patch | 6.530214  6.319840  6.491603

Performance degradation is still not a problem at 64 threads as there is not 
much lock contention.

The 'connection reset by peer' problem is still there, though, but it's hard 
to trigger (seems to happen more after startup).

Gabor
(eval-when (:compile-toplevel :load-toplevel)
  (use-package :sb-thread)
  (use-package :sb-bsd-sockets))

(Continue reading)

Daniel Barlow | 4 Apr 2005 18:18

Re: [Sbcl-help] Oddity with make-thread and sleep.

Gábor Melis <mega <at> hotpop.com> writes:

> The attached patch implements sleep with nanosleep, calling it again when 
> necessary.

Thanks.  Do you know how portable nanosleep() is?  The manual page
I have says POSIX.1b, so slightly-special but not especially-special.

SBCL committers: I propose to apply this patch, so if an OS you're
using has no nanosleep() or no working nanosleep, now would be a
really good time to object.  Cheers.

-dan

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Raymond Wiker | 4 Apr 2005 18:58
Picon

Re: Oddity with make-thread and sleep.

Daniel Barlow writes:
 > Gábor Melis <mega <at> hotpop.com> writes:
 > 
 > > The attached patch implements sleep with nanosleep, calling it again when 
 > > necessary.
 > 
 > Thanks.  Do you know how portable nanosleep() is?  The manual page
 > I have says POSIX.1b, so slightly-special but not especially-special.
 > 
 > SBCL committers: I propose to apply this patch, so if an OS you're
 > using has no nanosleep() or no working nanosleep, now would be a
 > really good time to object.  Cheers.

        FreeBSD and Mac OS X 10.3.8 have nanosleep, and claims 

:     The nanosleep() system call conforms to IEEE Std 1003.1b-1993
:     (``POSIX.1'').

--- any bets that the supposedly Posix-compatible MS Windows supports
this :-?

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
Gábor Melis | 5 Apr 2005 13:23

Re: [Sbcl-help] threads, streams, memory leak?

On Monday 04 April 2005 18:00, Gábor Melis wrote:
> I've found a message describing the exact same problem:
> http://article.gmane.org/gmane.lisp.steel-bank.devel/1879
>
> SBCL allocates two buffers on the wrong thread (accept), and never calls
>
> deallocate-system-memory when the thread exits, so not even restarting
> the
> server can discard the accumulated buffers.
>
> Some measurements were conducted on sbcl 0.8.21 with the attached
> program
> against apache bench. GC was turned off.
>
> /usr/sbin/ab -n 10000 -c 64 http://localhost:2002/
>
> concurrency       |     1        8         64
> ------------------------------------------------
> without patches   | 6.988660  6.779214  6.736636
> B Downing's patch | 6.530214  6.319840  6.491603
>
> Performance degradation is still not a problem at 64 threads as there is
> not
> much lock contention.
>
> The 'connection reset by peer' problem is still there, though, but it's
> hard to trigger (seems to happen more after startup).

I'd hate to monopolize this thread, but I've found the cause of the connection 
reset by peer problem: the test program has not read the request.
(Continue reading)

Gabor Melis | 5 Apr 2005 15:53
Picon

Re: Re: [Sbcl-help] Oddity with make-thread and sleep.

On Monday 04 April 2005 18:18, Daniel Barlow wrote:
> Gábor Melis <mega <at> hotpop.com> writes:
> > The attached patch implements sleep with nanosleep, calling it again
>
> when
>
> > necessary.
>
> Thanks.  Do you know how portable nanosleep() is?  The manual page
> I have says POSIX.1b, so slightly-special but not especially-special.
>
> SBCL committers: I propose to apply this patch, so if an OS you're
> using has no nanosleep() or no working nanosleep, now would be a
> really good time to object.  Cheers.
>
>
> -dan

Oops, I forgot to include tools-for-build in the patch.

Index: tools-for-build/ldso-stubs.lisp
===================================================================
RCS file: /cvsroot/sbcl/sbcl/tools-for-build/ldso-stubs.lisp,v
retrieving revision 1.5
diff -u -r1.5 ldso-stubs.lisp
--- tools-for-build/ldso-stubs.lisp     6 Jan 2005 12:48:05 -0000       1.5
+++ tools-for-build/ldso-stubs.lisp     5 Apr 2005 13:48:51 -0000
 <at>  <at>  -198,6 +198,7  <at>  <at> 
                    "malloc"
                    "memmove"
(Continue reading)

R. Mattes | 6 Apr 2005 15:37
Picon

Character coding question

Hello list,

is there a way to create strings with different encodings in recent 
sbcls? I'm running 0.8.20 with unicode support but need to convert strings
to ISO-8859-1 at some places in my program. Is there any support for this
at all? Is there syntactic sugar available (like, for example an
:character-encoding keyword for with-output-to-string).

 TIA Ralf Mattes

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
Christophe Rhodes | 6 Apr 2005 16:22
Picon
Picon
Favicon

Re: Character coding question

"R. Mattes" <rm <at> mh-freiburg.de> writes:

> is there a way to create strings with different encodings in recent 
> sbcls? I'm running 0.8.20 with unicode support but need to convert strings
> to ISO-8859-1 at some places in my program. Is there any support for this
> at all? Is there syntactic sugar available (like, for example an
> :character-encoding keyword for with-output-to-string).

Strings are not encoded; they are sequences of characters; as such, a
:character-encoding or :external-format for string output streams
makes no sense, because a character is fundamentally not an integer.

So, what are you actually trying to do?  I'm guessing you want an
iso-8859-1 encoding of your string, maybe to write to a file, or to
pass to a foreign function; for that, you'd need a sequence of bytes.
To do that, look at the sb-ext:string-to-octets function.

Cheers,

Christophe

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click

Gmane