[hunchentoot-devel] Handling multiple Hunchentoot instances with potentially conflicting ports
Raditya Kertiyasa
adit_kerti at yahoo.com
Fri May 30 13:11:12 UTC 2008
Hans,
Thanks for the explanation and suggestion. I've never used SVN before,
but I'll give it a try. If there are alternative methods such as
invoking START-SERVER without creating a new thread on the version I'm
using (the one I got from Ubuntu repos), or maybe checking if the port
in question is already bind before even invoking START-SERVER, I'm all ears.
By the way, I think Hunchentoot is great! Thanks Edi and you for making
my life easier.
Regards,
Raditya Kertiyasa
Hans Hübner wrote:
> Hi Raditya,
>
> the problem that you see results from the fact that Hunchentoot sets
> up the listen socket in a new thread. The handler and restart that
> you set up around the START-SERVER invocation are not active in that
> thread.
>
> You may want to have a look at the new development version of
> Hunchentoot. In this version, both LISTEN-FOR-CONNECTIONS and
> EXECUTE-LISTENER are generic functions that you could augment with
> :AROUND methods to handle port conflicts. The new version is not
> finalized and these generic functions are not yet mentioned in the
> official API documentation, but if you need to get running quickly, it
> may be worth a try.
>
> Use "svn co svn://bknr.net/svn/ediware" to check out the development
> version of Hunchentoot and all required dependencies.
>
> -Hans
>
> On Thu, May 29, 2008 at 11:55 PM, Raditya Kertiyasa
> <adit_kerti at yahoo.com> wrote:
>
>> Hi everbody,
>>
>> I'm a Lisp newbie but I need to get my system up and running fast. I'm
>> building a system that might cause multiple Hunchentoot servers to use
>> conflicting ports. I want to handle this with an error handler and I've
>> setup a wrapper function to start Hunchentoot and a restart function:
>>
>> ;; restart function to handle conflicting ports
>> (defun ht-port-conflict-handler (condition)
>> (... do something here to address the conflicting ports ...)
>> (invoke-restart 'ht-port-conflict-handler))
>>
>>
>> ;; Start Hunchentoot Server with error-handling
>> (defun ht-start-with-error-handler ()
>> (handler-bind ((simple-error #'ht-port-conflict-handler))
>> (restart-case (setf *ht-handle* (hunchentoot:start-server
>> :port *ht-port*))
>> (ht-port-conflict-handler () nil))))
>>
>> The system should allow users to reconfigure their instance of Hunchentoot
>> without having to invoke the debugger, but when I run this code I always end
>> up in the debugger anyway. Can anybody tell me where I went wrong? Or maybe
>> there's a better solution for my situation?
>>
>> Regards,
>> Raditya Kertiyasa
>>
>> _______________________________________________
>> tbnl-devel site list
>> tbnl-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>
>>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
>
More information about the Tbnl-devel
mailing list