From k.ponting at aurix.com  Mon Nov  6 12:23:59 2006
From: k.ponting at aurix.com (Keith Ponting)
Date: Mon, 6 Nov 2006 11:23:59 -0000
Subject: [Rd]  CRAN task views work only once per session (PR#9330)
Message-ID: <6583C92252A35A4C97E64E50716110F8034FFB8E@mailx03.virtual-email.net>

Thankyou to those who have replied to this thread.

I have now reproduced similar effects in a way which does not directly
involve CRAN task views. (I have also reproduced the original problem on
a different machine within
our site and using a different mirror.)

The following sequence of commands works repeatedly within plain Rterm
(actually running under XEmacs) on Windows XP:

x<-url("http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds",open="rb"
);
showConnections()
.readRDS(x);
showConnections()
close(x)
showConnections()

However under RGui on the same system, second and subsequent attempts
time out in .readRDS (see session log below) and note that although the
connection is shown as open immediately before the second .readRDS call,
it is shown as closed immediately after that (failing) call. 

I wonder whether something in RGui is holding on to connections after
they have been closed. Even while .readRDS is timing out in one RGui
session, I can run that sequence of calls in plain Rterm or (once!) in
another RGui session without problems, which I hope eliminates the
possibility that it is our company firewall or something else on my PC
holding on to the connection in some way.

---------- session log starts
------------------------------------------------

R version 2.4.0 (2006-10-03)
Copyright (C) 2006 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>
x<-url("http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds",open="rb"
);
> showConnections()
  description                                             class mode
text    
3 "http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds" "url" "rb"
"binary"
  isopen   can read can write
3 "opened" "yes"    "no"     
> .readRDS(x);
> showConnections()
  description                                                    class
mode
3 "gzcon(http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds)" "gzcon"
"rb"
  text     isopen   can read can write
3 "binary" "opened" "yes"    "no"     
> close(x)
> showConnections()
     description class mode text isopen can read can write
>
x<-url("http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds",open="rb"
);
> showConnections()
  description                                             class mode
text    
3 "http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds" "url" "rb"
"binary"
  isopen   can read can write
3 "opened" "yes"    "no"     
> .readRDS(x);
Error in .readRDS(x) : connection is not open
In addition: Warning message:
InternetOpenUrl failed: 'The operation timed out' 
> showConnections()
     description class mode text isopen can read can write
> close(x)
> showConnections()
     description class mode text isopen can read can write
>
x<-url("http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds",open="rb"
);
> showConnections()
  description                                             class mode
text    
3 "http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds" "url" "rb"
"binary"
  isopen   can read can write
3 "opened" "yes"    "no"     
> .readRDS(x);
Error in .readRDS(x) : connection is not open
In addition: Warning message:
InternetOpenUrl failed: 'The operation timed out' 
> showConnections()
     description class mode text isopen can read can write
> close(x)
> showConnections()
     description class mode text isopen can read can write
> 
> sessionInfo()
R version 2.4.0 (2006-10-03) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
"datasets" 
[7] "base"     
> 

---------- session log ends
------------------------------------------------

If I remove the .readRDS(x) call, there is no problem - the following
command sequence does work repeatedly:
x<-url("http://www.sourcekeg.co.uk/cran/src/contrib/Views.rds",open="rb"
);
showConnections()
close(x)
showConnections()

Dr. Keith Ponting
Principal Scientist

Aurix Ltd
Malvern Hills Science Park
Geraldine Rd  Malvern  Worcestershire  WR14 3SZ  UK

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information visit http://www.virtual-email.net/messagelabs.htm



[Rd] CRAN task views work only once per session (PR#9330)
Keith Ponting