Yes, I think you're right. I originally wrote that because I was
thinking that this code might be involved in evaluating the user's
submission, but I am not pretty sure I was wrong about that. So, yes I
agree that putting this into the production server may be worth a try
(depending on how severe the problem you're having is I suppose).

It may make sense to try it out yourself a little bit between due
dates or something. I did some testing, but more is better.

Also, while I was reading the code again, however, I noticed that my
diff didn't have enough syncronization. Here's an improved one.

Robby

diff --git a/handin-server/private/reloadable.rkt
b/handin-server/private/reloadable.rkt
index 1055822..32de38f 100644
--- a/handin-server/private/reloadable.rkt
+++ b/handin-server/private/reloadable.rkt
@@ -1,8 +1,36 @@
 #lang racket/base

 (require syntax/moddep "logger.rkt")
+(module mon racket/base
+  (define sema (make-semaphore 1))
+  (define-syntax-rule
+    (provide/monitor (id x ...))
+    (begin
+      (define -id
+        (let ([id (λ (x ...)
+                    (call-with-semaphore
+                     sema
+                     (λ () (id x ...))))])
+          id))
+      (provide (rename-out [-id id]))))
+  (define-syntax-rule
+    (protect e)
+    (call-with-semaphore sema (λ () e)))
+  (provide provide/monitor protect))
+(require (submod "." mon))

-(provide reload-module)
+(module+ test
+  (module m racket/base
+    (require (submod ".." ".." mon))
+    (define (f x) (* 2 (g x)))
+    (define (g x) (+ x 1))
+    (provide/monitor (f x))
+    (provide/monitor (g x)))
+  (require (submod "." m) rackunit)
+  (check-equal? (g 2) 3)
+  (check-equal? (f 11) 24))
+
+(provide/monitor (reload-module modspec path))
 (define (reload-module modspec path)
   ;; the path argument is not needed (could use resolve-module-path here), but
   ;; its always known when this function is called
@@ -20,7 +48,7 @@

 ;; pulls out a value from a module, reloading the module if its source file was
 ;; modified
-(provide auto-reload-value)
+(provide/monitor (auto-reload-value modspec valname))
 (define module-times (make-hash))
 (define (auto-reload-value modspec valname)
   (define path0 (resolve-module-path modspec #f))
@@ -43,7 +71,7 @@
 ;; pulls out a procedure from a module, and returns a wrapped procedure that
 ;; automatically reloads the module if the file was changed whenever the
 ;; procedure is used
-(provide auto-reload-procedure)
+(provide/monitor (auto-reload-procedure x y))
 (define (auto-reload-procedure modspec procname)
   (let ([path (resolve-module-path modspec #f)] [date #f] [proc #f] [poll #f])
     (define (reload)
@@ -55,4 +83,4 @@
             (reload-module modspec path)
             (set! proc (dynamic-require modspec procname))))))
     (reload)
-    (lambda xs (reload) (apply proc xs))))
+    (lambda xs (protect (reload)) (apply proc xs))))
diff --git a/info.rkt b/info.rkt
index 00a42f9..a5686d5 100644
--- a/info.rkt
+++ b/info.rkt
@@ -11,6 +11,7 @@
                "net-lib"
                "pconvert-lib"
                "sandbox-lib"
+               "rackunit-lib"
                "web-server-lib"))
 (define build-deps '("gui-doc"
                      "racket-doc"


On Thu, Nov 26, 2015 at 6:23 PM, Paolo Giarrusso <p.giarru...@gmail.com> wrote:
> On 25 November 2015 at 14:54, Robby Findler <ro...@eecs.northwestern.edu> 
> wrote:
>> I'm still not completely
>> sure, but since you seem to be able to provoke the error, that
>> emboldens me to suggest you apply the diff below and see if it goes
>> away.
>
> I'm doing this. Annoyingly, I can't force the crash at will yet, and
> an automated handin-server stress-tester is not in our plans yet :-|.
>
>> That diff is probably not what we'd want in the end, since it is too
>> much locking (we would want a namespace-specific lock not a global
>> one) but if the error does go away, that means that this is probably
>> the right place to put the lock in.
>
> Makes sense.
>
> But for my production environment, I guess that this patch won't
> overly restrict concurrency: I guess namespaces correspond to checkers
> in the handin-server, right? So, since I only ever open one
> assignment, I should only have one namespace anyway?
>
> Cheers,
> Paolo

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to