Re: [racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
I've confirmed it's definitely client side, by redirecting the handin server's 
address to 127.0.0.1 in /etc/hosts, and listening with `nc -l`. The handin 
client hangs on "Making secure connection ..." and nc display nothing at all. A 
few restarts and `nc -l` displays a bunch of gibberish that I'm guessing is the 
handin protocol, and killing `nc` triggers the handin client to report a 
connection error.

So it's:
- handin client side
- maybe related to openssl
- nondeterministic
- when it occurs, it will recur until you restart DrRacket
- when it doesn't occur, it will not recur until you restart DrRacket
- affects 8.1 BC
- affects 8.1 CS
- affects 8.2.0.2 CS 
- results in the client failing send anything to the network

--
William J. Bowman

On Sat, Sep 18, 2021 at 08:05:10PM -0700, 'William J. Bowman' via Racket Users 
wrote:
> Since I'm currently experiencing the issue, I've been able to get some better 
> data. I've managed to reproduce it in 8.2.0.2 CS, which suggests it's not 
> https://github.com/racket/racket/issues/3804.
> 
> Restarting twice DrRacket hasn't helped, nor has resetting my wifi connection.
> 
> After connecting via a browser, I notice a lot of the following in the log 
> that seem to correlate with my attempts in the browser:
> > [-|2021-09-18T19:37:45] handin: unknown protocol: #"GET / HTTP/1.1"
> > ...
> > [-|2021-09-18T19:37:53] ERROR: ssl-accept/enable-break: accept failed 
> > (error:1408F09C:SSL routines:ssl3_get_record:http request)
> 
> As expected, nothing seem to correlate with my attempts to connect from the 
> handin plugin.
> 
> This makes me suspect the server, but I can't reconcile that with why there's 
> nothing in the logs.
> 
> --
> William J. Bowman
> 
> On Sat, Sep 18, 2021 at 06:59:43PM -0700, 'William J. Bowman' via Racket 
> Users wrote:
> > I just tried this, but I can't seem to connect.
> >   http://cs110.students.cs.ubc.ca:7979/
> > gives "connection reset", and 
> >   https://cs110.students.cs.ubc.ca:7979/
> > gives "secure connection failed".
> > 
> > There's no prompt to accept the certificate (which I wouldn't expect, 
> > because we're using a CA signed certificate through Let's Encrypt, not a 
> > self-signed certificate).
> > 
> > I'm currently experiencing the problem on my own client. I'm not sure if 
> > that's related; I also couldn't connect from my phone.
> > 
> > --
> > William J. Bowman
> > 
> > On Sat, Sep 18, 2021 at 09:24:05PM -0400, Sam Tobin-Hochstadt wrote:
> > > Have you tried visiting the server with a browser? That should work,
> > > although you'll have to accept the certificate. It might also indicate 
> > > some
> > > aspect of the behavior.
> > > 
> > > Sam
> > > 
> > > On Sat, Sep 18, 2021, 7:13 PM 'William J. Bowman' via Racket Users <
> > > racket-users@googlegroups.com> wrote:
> > > 
> > > > I need some help debugging an issue with the handin package. The handin
> > > > plugin (client) displays “Making secure connection to  
> > > > …”,
> > > > and simply hangs. Closing the dialog and trying again never resolves the
> > > > issue.
> > > >
> > > > The only method that seems to resolve the issue, although 
> > > > inconsistently,
> > > > is restarting DrRacket, opening a new file, and trying to submit that 
> > > > new
> > > > file. This sometimes, but not always, enables the client to connect. 
> > > > Once
> > > > it does connect, the issue doesn't seem to recur for some time. The 
> > > > client
> > > > can make multiple successful submissions, at least until the end of 
> > > > lecture
> > > > (maybe related to the next time they disconnect/reconnect to the 
> > > > internet).
> > > >
> > > > We running Racket 7.8 on the server and 8.1 BC on the clients. We've 
> > > > seen
> > > > the issue occur on many operating system---old and new versions of 
> > > > macOS,
> > > > Windows 10, and at one report on Linux.
> > > >
> > > > I can't just upgrade the clients to 8.2, since there's a bug in 8.2 that
> > > > affects rendering inexact numbers in BSL, so I really want some 
> > > > confidence
> > > > about what the issue is before I start upgrading versions.
> > > >
> > > > Anecdotally, the problem seems more common this semester compared to the
> > > > previous semester, and we upgraded the clients to 8.1 this semester,
> > > > suggesting the clients are at fault.
> > > >
> > > > When this problem occurs, there is nothing in the log on the handin
> > > > server, suggesting the client did not even manage to initiate the
> > > > connection to the server. In particular, the server never seems to make 
> > > > it
> > > > to this log line:
> > > >
> > > > https://github.com/racket/handin/blob/ac08937cc6b1eca8abe3d4d4df59876f95cbea17/handin-server/main.rkt#L679
> > > > This is one the earliest log lines and before pretty much anything
> > > > happens, so we're *PRETTY SURE* the client is blocking.
> > > >
> > > > Right now, my best guess is that we might be affected by this bug, which
> > > > causes SSL ports to block 

Re: [racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
Since I'm currently experiencing the issue, I've been able to get some better 
data. I've managed to reproduce it in 8.2.0.2 CS, which suggests it's not 
https://github.com/racket/racket/issues/3804.

Restarting twice DrRacket hasn't helped, nor has resetting my wifi connection.

After connecting via a browser, I notice a lot of the following in the log that 
seem to correlate with my attempts in the browser:
> [-|2021-09-18T19:37:45] handin: unknown protocol: #"GET / HTTP/1.1"
> ...
> [-|2021-09-18T19:37:53] ERROR: ssl-accept/enable-break: accept failed 
> (error:1408F09C:SSL routines:ssl3_get_record:http request)

As expected, nothing seem to correlate with my attempts to connect from the 
handin plugin.

This makes me suspect the server, but I can't reconcile that with why there's 
nothing in the logs.

--
William J. Bowman

On Sat, Sep 18, 2021 at 06:59:43PM -0700, 'William J. Bowman' via Racket Users 
wrote:
> I just tried this, but I can't seem to connect.
>   http://cs110.students.cs.ubc.ca:7979/
> gives "connection reset", and 
>   https://cs110.students.cs.ubc.ca:7979/
> gives "secure connection failed".
> 
> There's no prompt to accept the certificate (which I wouldn't expect, because 
> we're using a CA signed certificate through Let's Encrypt, not a self-signed 
> certificate).
> 
> I'm currently experiencing the problem on my own client. I'm not sure if 
> that's related; I also couldn't connect from my phone.
> 
> --
> William J. Bowman
> 
> On Sat, Sep 18, 2021 at 09:24:05PM -0400, Sam Tobin-Hochstadt wrote:
> > Have you tried visiting the server with a browser? That should work,
> > although you'll have to accept the certificate. It might also indicate some
> > aspect of the behavior.
> > 
> > Sam
> > 
> > On Sat, Sep 18, 2021, 7:13 PM 'William J. Bowman' via Racket Users <
> > racket-users@googlegroups.com> wrote:
> > 
> > > I need some help debugging an issue with the handin package. The handin
> > > plugin (client) displays “Making secure connection to  …”,
> > > and simply hangs. Closing the dialog and trying again never resolves the
> > > issue.
> > >
> > > The only method that seems to resolve the issue, although inconsistently,
> > > is restarting DrRacket, opening a new file, and trying to submit that new
> > > file. This sometimes, but not always, enables the client to connect. Once
> > > it does connect, the issue doesn't seem to recur for some time. The client
> > > can make multiple successful submissions, at least until the end of 
> > > lecture
> > > (maybe related to the next time they disconnect/reconnect to the 
> > > internet).
> > >
> > > We running Racket 7.8 on the server and 8.1 BC on the clients. We've seen
> > > the issue occur on many operating system---old and new versions of macOS,
> > > Windows 10, and at one report on Linux.
> > >
> > > I can't just upgrade the clients to 8.2, since there's a bug in 8.2 that
> > > affects rendering inexact numbers in BSL, so I really want some confidence
> > > about what the issue is before I start upgrading versions.
> > >
> > > Anecdotally, the problem seems more common this semester compared to the
> > > previous semester, and we upgraded the clients to 8.1 this semester,
> > > suggesting the clients are at fault.
> > >
> > > When this problem occurs, there is nothing in the log on the handin
> > > server, suggesting the client did not even manage to initiate the
> > > connection to the server. In particular, the server never seems to make it
> > > to this log line:
> > >
> > > https://github.com/racket/handin/blob/ac08937cc6b1eca8abe3d4d4df59876f95cbea17/handin-server/main.rkt#L679
> > > This is one the earliest log lines and before pretty much anything
> > > happens, so we're *PRETTY SURE* the client is blocking.
> > >
> > > Right now, my best guess is that we might be affected by this bug, which
> > > causes SSL ports to block incorrectly:
> > >   https://github.com/racket/racket/issues/3804
> > >
> > > If so, it would probably be in the client, unless `(ssl-addresses r)` can
> > > block in the same way on the server, since otherwise the above log line
> > > would execute.
> > >
> > > However, if it is the client, I don't have any explanation about why
> > > restarting DrRacket would workaround the bug, or why it sometimes doesn't
> > > work.
> > >
> > > I'd appreciate any help.
> > >
> > > --
> > > William J. Bowman
> > >
> > > --
> > > 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.
> > > To view this discussion on the web visit
> > > https://groups.google.com/d/msgid/racket-users/YUZyWlsY9CdCDyPu%40williamjbowman.com
> > > .
> > >
> 
> -- 
> 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 

Re: [racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
I just tried this, but I can't seem to connect.
  http://cs110.students.cs.ubc.ca:7979/
gives "connection reset", and 
  https://cs110.students.cs.ubc.ca:7979/
gives "secure connection failed".

There's no prompt to accept the certificate (which I wouldn't expect, because 
we're using a CA signed certificate through Let's Encrypt, not a self-signed 
certificate).

I'm currently experiencing the problem on my own client. I'm not sure if that's 
related; I also couldn't connect from my phone.

--
William J. Bowman

On Sat, Sep 18, 2021 at 09:24:05PM -0400, Sam Tobin-Hochstadt wrote:
> Have you tried visiting the server with a browser? That should work,
> although you'll have to accept the certificate. It might also indicate some
> aspect of the behavior.
> 
> Sam
> 
> On Sat, Sep 18, 2021, 7:13 PM 'William J. Bowman' via Racket Users <
> racket-users@googlegroups.com> wrote:
> 
> > I need some help debugging an issue with the handin package. The handin
> > plugin (client) displays “Making secure connection to  …”,
> > and simply hangs. Closing the dialog and trying again never resolves the
> > issue.
> >
> > The only method that seems to resolve the issue, although inconsistently,
> > is restarting DrRacket, opening a new file, and trying to submit that new
> > file. This sometimes, but not always, enables the client to connect. Once
> > it does connect, the issue doesn't seem to recur for some time. The client
> > can make multiple successful submissions, at least until the end of lecture
> > (maybe related to the next time they disconnect/reconnect to the internet).
> >
> > We running Racket 7.8 on the server and 8.1 BC on the clients. We've seen
> > the issue occur on many operating system---old and new versions of macOS,
> > Windows 10, and at one report on Linux.
> >
> > I can't just upgrade the clients to 8.2, since there's a bug in 8.2 that
> > affects rendering inexact numbers in BSL, so I really want some confidence
> > about what the issue is before I start upgrading versions.
> >
> > Anecdotally, the problem seems more common this semester compared to the
> > previous semester, and we upgraded the clients to 8.1 this semester,
> > suggesting the clients are at fault.
> >
> > When this problem occurs, there is nothing in the log on the handin
> > server, suggesting the client did not even manage to initiate the
> > connection to the server. In particular, the server never seems to make it
> > to this log line:
> >
> > https://github.com/racket/handin/blob/ac08937cc6b1eca8abe3d4d4df59876f95cbea17/handin-server/main.rkt#L679
> > This is one the earliest log lines and before pretty much anything
> > happens, so we're *PRETTY SURE* the client is blocking.
> >
> > Right now, my best guess is that we might be affected by this bug, which
> > causes SSL ports to block incorrectly:
> >   https://github.com/racket/racket/issues/3804
> >
> > If so, it would probably be in the client, unless `(ssl-addresses r)` can
> > block in the same way on the server, since otherwise the above log line
> > would execute.
> >
> > However, if it is the client, I don't have any explanation about why
> > restarting DrRacket would workaround the bug, or why it sometimes doesn't
> > work.
> >
> > I'd appreciate any help.
> >
> > --
> > William J. Bowman
> >
> > --
> > 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.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/racket-users/YUZyWlsY9CdCDyPu%40williamjbowman.com
> > .
> >

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/YUaZj9v0Lch0jfMC%40williamjbowman.com.


[racket-users] Help debugging handin client connection problem

2021-09-18 Thread 'William J. Bowman' via Racket Users
I need some help debugging an issue with the handin package. The handin plugin 
(client) displays “Making secure connection to  …”, and simply 
hangs. Closing the dialog and trying again never resolves the issue.

The only method that seems to resolve the issue, although inconsistently, is 
restarting DrRacket, opening a new file, and trying to submit that new file. 
This sometimes, but not always, enables the client to connect. Once it does 
connect, the issue doesn't seem to recur for some time. The client can make 
multiple successful submissions, at least until the end of lecture (maybe 
related to the next time they disconnect/reconnect to the internet).

We running Racket 7.8 on the server and 8.1 BC on the clients. We've seen the 
issue occur on many operating system---old and new versions of macOS, Windows 
10, and at one report on Linux.

I can't just upgrade the clients to 8.2, since there's a bug in 8.2 that 
affects rendering inexact numbers in BSL, so I really want some confidence 
about what the issue is before I start upgrading versions.

Anecdotally, the problem seems more common this semester compared to the 
previous semester, and we upgraded the clients to 8.1 this semester, suggesting 
the clients are at fault.

When this problem occurs, there is nothing in the log on the handin server, 
suggesting the client did not even manage to initiate the connection to the 
server. In particular, the server never seems to make it to this log line:
  
https://github.com/racket/handin/blob/ac08937cc6b1eca8abe3d4d4df59876f95cbea17/handin-server/main.rkt#L679
This is one the earliest log lines and before pretty much anything happens, so 
we're *PRETTY SURE* the client is blocking.

Right now, my best guess is that we might be affected by this bug, which causes 
SSL ports to block incorrectly:
  https://github.com/racket/racket/issues/3804

If so, it would probably be in the client, unless `(ssl-addresses r)` can block 
in the same way on the server, since otherwise the above log line would execute.

However, if it is the client, I don't have any explanation about why restarting 
DrRacket would workaround the bug, or why it sometimes doesn't work.

I'd appreciate any help.

-- 
William J. Bowman

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/YUZyWlsY9CdCDyPu%40williamjbowman.com.


Re: [racket-users] Is it possible to capture a the value of a variable inside a macro?

2021-09-18 Thread Dimaugh Silvestris
Ohhh, thank you so much, Sorawee! Now I have wealth of code to study.
By the way, I tried to send my full code but apparently once again I hit 
the "reply" button instead of "reply all" and I only sent it to David, so 
here it is again in case anyone wants to play with it. I haven't 
implemented field accessors yet because those are trivial (and since I keep 
field names somewhere else, I could implement them differently, like (get 
'field mycard), though that would probably be slower).


#lang racket/base
(require (for-syntax racket/base
 syntax/parse
 racket/syntax)
 syntax/parse/define)
(require (only-in racket ~a))

(provide card)     create a card-out thingy

(define-for-syntax (parse-args xs [rs '()])
  (define (fn xs)
(if [null? xs] '[]
[let [(a (car xs))
  (bs (cdr xs))]
  (cond [(keyword? a) (fn bs)]
[(list? a) (cons (car a) (fn bs))]
[else (cons a (fn bs))])]))
  (let [(parsed (fn xs))
(dotlist rs)]
(if [null? dotlist]
parsed [append parsed (list dotlist)])))

(define keyword (string->keyword "~a"))
(define keyword-prefix "#:")
(define keyword-suffix "")

;;

   
(require (only-in racket/struct
  make-constructor-style-printer))

(define-syntax (protocard stx)
  (syntax-case stx ()
   ([_ super (name fields ... . xs)]
(with-syntax [(descr (format-id #'name "record:~a" #'name))
  (pred? (format-id #'name "~a?" #'name))
  (maker (format-id #'name "make-~a" #'name))
  (ref (format-id #'name "~a-ref" #'name))
  (set (format-id #'name "~a-set!" #'name))
  (field-names (format-id #'name "*~a-fields" #'name))
  (explain (format-id #'name "explain-~a" #'name))
  (tag-params (tag-args (syntax->datum #'(fields ...)) 
(syntax->datum #'xs))) 
  (plain-params
   (cons list (map [λ (x) (format-id #'name "~a" x)]
   [parse-args (syntax->datum #'(fields 
...))
   (syntax->datum #'xs)])))]  
;;; éste debería de salir de tag-params
  
  #`[begin
  (define field-names '(fields ... . xs))
  (define-values (descr maker pred? ref set)
(make-struct-type
 'name super (length 'tag-params) 0 #f   ;; (- (length 
super-fields))
 (list (cons prop:custom-write
 (make-constructor-style-printer  
  (λ (obj)
(apply string-append
   (symbol->string 'name)
   (for/list ((arg 'tag-params) (i 
(in-naturals 0)))
 (print-params (ref obj i) arg
  (λ (obj) '()) )
  (define (explain obj)
(for/list [(p (cdr 'plain-params)) (i (in-naturals 0))]
  (list p (ref obj i
  (define (name fields ... . xs)
(apply maker plain-params))
  ;;; accessors!!
  #|(define whatev
(append 'field-names
'super-fields))|#
  ;#,@[if ]
  ]

(define-syntax (card stx)
  (syntax-case stx ()
([_ (name fields ... . xs)]
 #'[protocard #f (name fields ... . xs)])
([_ super (name fields ... . xs)]
 #'[protocard super (name fields ... . xs)])))

;;;

;;

(define-for-syntax (tag-args xs [rs '()]) 
  (define parsed
(if [null? xs] '[]
   [let ((a (car xs))
 (bs (cdr xs)))
 (cond ((symbol? a) (cons a (tag-args bs)))
   ((list? a) (cons a (tag-args bs)))
   ((keyword? a)
(cons (list a (car bs))
  (tag-args (cdr bs)]))
  (if [null? rs] parsed [append parsed (list rs)]))
 
;;

(define  (write-if-not-default a-pair val)
  (if [equal? (cadr a-pair) val] ""
  [string-append " " (~a val)]))

(define (print-params val arg)
  (cond
((symbol? arg)
 (string-append " " (~a val)))
((keyword? (car arg))
 (let ((x (cadr arg))
   (res (string-append " " keyword-prefix  
   (keyword->string (car arg))
   keyword-suffix " " (~a val
   (if (list? x)  ;; if it's a default arg, x (cadr arg) appears as a 
list
   (if (eq? (cadr x) val) ""  ;; don't show if it has the default 
value (cadr x)
   res) res)))
((list? arg)
 (write-if-not-default arg val


On Saturday, 18 September 2021 at 03:06:36 UTC+2 sorawe...@gmail.com wrote:

> 2) (card (line . xs)) has only one field, xs. Of course, you could also 
>> define it as a normal field which contains a list, but there's some other 
>> scenarios where I found it more elegant to