Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt workaround of CRAN Windows hang on update.dev.pkg.Rd example #5421

Merged
merged 12 commits into from
Jul 20, 2022

Conversation

jangorecki
Copy link
Member

@jangorecki jangorecki commented Jul 19, 2022

Try to address unknown hung in https://www.r-project.org/nosvn/R.check/r-release-windows-x86_64/data.table-00check.html

checking tests ...
Check process probably crashed or hung up for 20 minutes ... killed
Most likely this happened in the example checks (?),
if not, ignore the following last lines of example output:
> ### * update.dev.pkg
>
> flush(stderr()); flush(stdout())
>
> ### Name: update.dev.pkg
> ### Title: Perform update of development version of a package
> ### Aliases: update update.dev.pkg
> ### Keywords: data
>
> ### ** Examples
>
> # data.table::update.dev.pkg()
>
>
>
> ### * <FOOTER>
> ###
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed: 6.28 0.33 7.64 NA NA
> grDevices::dev.off()
null device
          1
> ###
> ### Local variables: ***
> ### mode: outline-minor ***
> ### outline-regexp: "\\(> \\)?### [*]+" ***
> ### End: ***
> quit('no')

Closes #5304 too by changing the name (see discussion below).

@jangorecki jangorecki added this to the 1.14.3 milestone Jul 19, 2022
@mattdowle
Copy link
Member

mattdowle commented Jul 19, 2022

That's an interesting idea! This error has been occurring sporadically on Windows CRAN for I'd guess well over a year and I'd emailed Uwe about it asking for any insight. I figured it was timing out due to resource issues on that machine, or perhaps related to tests using 2 threads; i.e. timing out in .Rd examples because those are tested last or something. But since it always times out on this particular example, I suppose it does make sense that it is actually to do with this example! I couldn't see the wood for the trees.
Since it only happens on CRAN's Windows machine and not in our Windows CI it's going to be tricky to test. I'll contact Uwe to see if he's aware of anything to do with empty examples causing hangs on Windows. If that is the problem, it feels like the root cause is something in R and/or CRAN's Windows machine and we shouldn't need to change this example. After all, an empty example should be ok.
Actually, we have --no-manual in .appveyor.yml, so I guess that doesn't test examples. I'll turn on manual to see if it then hangs. [Update: examples are run even when --no-manual so it's ok to keep --no-manual which is there to avoid an error 'pdflatex is not available'.]

@jangorecki
Copy link
Member Author

jangorecki commented Jul 19, 2022

Yes this one is very strange. I tried to change two things.
Use double ## in case there is some magic that runs single # commented out function calls in examples when "run dontrun" or whatever.
Put any non commented out code to execute in this examples, in case empty examples block cause troubles.

@mattdowle
Copy link
Member

mattdowle commented Jul 19, 2022

(That merge master was to bring in #5398 to make AppVeyor work again.)

I did grep "examples{" *.Rd -A 5 and inspected the output to see if there are any other empty examples. Found these other two.

deprecated.Rd:\examples{
deprecated.Rd-# dummy example section to pass release check that all .Rd files have examples
deprecated.Rd-}

shouldPrint.Rd:\examples{
shouldPrint.Rd-# dummy example section to pass release check that all .Rd files have examples
shouldPrint.Rd-}

update.dev.pkg.Rd:\examples{
update.dev.pkg.Rd-  # data.table::update.dev.pkg()
update.dev.pkg.Rd-}

The only difference that I can see is that the update.dev.pkg.Rd one has two spaces at the start of the line. Using cat -A and od -c confirms they are regular spaces and not special characters. Really strange if those would cause the hang though.

@mattdowle mattdowle changed the title Make a non empty examples of upgrade pkg Attempt fix of CRAN Windows hang on update.dev.pkg.Rd example Jul 19, 2022
@mattdowle mattdowle changed the title Attempt fix of CRAN Windows hang on update.dev.pkg.Rd example Attempt workaround of CRAN Windows hang on update.dev.pkg.Rd example Jul 19, 2022
@@ -30,7 +30,9 @@
NULL.
}
\examples{
# data.table::update.dev.pkg()
\dontrun{
data.table::update.dev.pkg()
Copy link
Member Author

@jangorecki jangorecki Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds a risk of some test jobs running with run-dontrun. IMO it is better to completely protect from running it in examples, either by comment or if(FALSE) ...
I don't see a valid use case for running this example. Yet we should still have it there because the usage section is turned into update method for dev.pkg object, which is clearly wrong: #5304 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running dontrun seems odd to me but ok. I like that code in dontrun is still parsed and checked which isn't the case for comments. So that leads us to if(FALSE) then. Will do.
Regarding the usage section, our .Rd contains \method{update}{dev.pkg} which tells it it's a method. Can't we drop the \method part there, and remove the \alias{update} at the top too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it looks like a method of update but isn't actually, then that's the sort of thing that is easier to believe leads to a hang somehow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is _R_CHECK_DONTTEST_EXAMPLES_ but I don't see anything like that for \dontrun

@mattdowle
Copy link
Member

mattdowle commented Jul 20, 2022

Couldn't reproduce the hang using AppVeyor.

Indeed the manual page was misleading :
image

Now with the S3 method removed, 2 notes about the S3 method overlap, as Jan mentioned in his linked comment above.

* checking S3 generic/method consistency ... NOTE
Found the following apparent S3 methods exported but not registered:
  update.dev.pkg
See section ‘Registering S3 methods’ in the ‘Writing R Extensions’ manual.

* checking Rd \usage sections ... NOTE
S3 methods shown with full name in documentation object 'update.dev.pkg':
  ‘update.dev.pkg’

The \usage entries for S3 methods should use the \method markup and not their full name.
See chapter ‘Writing R documentation files’ in the ‘Writing R Extensions’ manual.

@MichaelChirico
Copy link
Member

looks like the best option is to rename it. shouldn't be a "prod" function anyway (maybe used in some docker images? should be searchable), so we can be more aggressive in the deprecation cycle

@mattdowle
Copy link
Member

mattdowle commented Jul 20, 2022

I think we should just get out of the way of stats::update and change the name. We're talking about a utility function here which upgrades the version of data.table, and to the development version too, so it's nothing to do with data.table's API and not like user's code could break. It's worth doing because, although strange, it could somehow be contributing to the hang on CRAN's Windows at this point, plus the manual entry displays as a S3 method which is misleading.
So update_dev_pkg() ?

@mattdowle
Copy link
Member

@MichaelChirico :) same conclusion at the same time, hadn't seen yours when I added mine

@MichaelChirico
Copy link
Member

hadn't seen yours when I added mine

😄

So update_dev_pkg() ?

yes that's what I had in mind

@mattdowle
Copy link
Member

grep -R "update[.]dev[.]pkg"

po/R-zh_CN.po:"Please update: data.table::update.dev.pkg()\n"
po/R-zh_CN.po:"table::update.dev.pkg()\n"
po/R-data.table.pot:msgid "**********\nThis development version of data.table was built more than 4 weeks ago. Please update: data.table::update.dev.pkg()\n**********"
man/data.table.Rd:  update.dev.pkg()
man/update.dev.pkg.Rd:\name{update.dev.pkg}
man/update.dev.pkg.Rd:\alias{update.dev.pkg}
man/update.dev.pkg.Rd:\usage{update.dev.pkg(object="data.table",
man/update.dev.pkg.Rd:  if (FALSE) data.table::update.dev.pkg()
NEWS.md:9. `data.table::update.dev.pkg()` now unloads the `data.table` namespace to alleviate a DLL lock issue on Windows, [#4403](https://github.com/Rdatatable/data.table/issues/4403). Thanks to @drag5 for reporting.
NEWS.md:4. `update.dev.pkg()` gains `type=` to specify if update should be made from binaries, sources or both. [#3148](https://github.com/Rdatatable/data.table/issues/3148). Thanks to Reino Bruner for the detailed suggestions.
NEWS.md:17. `update.dev.pkg` is new function to update package from development repository, it will download package sources only when newer commit is available in repository. `data.table::update.dev.pkg()` defaults updates `data.table`, but any package can be used.
NAMESPACE:export(update.dev.pkg)
README.md:data.table::update.dev.pkg()
R/onAttach.R:      packageStartupMessagef("**********\nThis development version of data.table was built more than 4 weeks ago. Please update: data.table::update.dev.pkg()\n**********")
R/devel.R:update.dev.pkg = function(object="data.table", repo="https://Rdatatable.gitlab.io/data.table", field="Revision", type=getOption("pkgType"), lib=NULL, ...) {
R/devel.R:  # update.dev.pkg fails on windows R 4.0.0, we have to unload package namespace before installing new version #4403

@MichaelChirico
Copy link
Member

GitHub search not turning up anything (TBF, it doesn't even match our repo... GH search is... not the best):

https://github.com/search?q=%22update.dev.package%28%22+-org%3ALien182+-org%3Aaomie-x+-org%3ABestduan+-extension%3Atcl+-extension%3Ajs&type=Code

@mattdowle
Copy link
Member

mattdowle commented Jul 20, 2022

I'm thinking it's unlikely Jan would disagree on the name change, so merging now to move on. We can always revisit/revert if needed.

@mattdowle mattdowle merged commit 4b16a7f into master Jul 20, 2022
@mattdowle mattdowle deleted the jangorecki-patch-1 branch July 20, 2022 02:25
@jangorecki
Copy link
Member Author

Yes, renaming seems to be the best solution.

@jangorecki
Copy link
Member Author

It was a fast fix, fail on cran is gone already and we haven't yet released to cran :)

@mattdowle
Copy link
Member

After rename and 1.14.4 is now on CRAN, it's still failing. It seems my original intuition (written above) was right then and the fail on Windows is not related to this .Rd file. It's probably just that this .Rd file is the last one so it's the last thing displayed in the log before the kill happens later in tests.
The log displayed on CRAN does display a last helpful line (below) which was omitted from the original comment above.

checking tests ...
Check process probably crashed or hung up for 20 minutes ... killed
Most likely this happened in the example checks (?),
if not, ignore the following last lines of example output:
>
> ### Name: update_dev_pkg
...
> ### End: ***
> quit('no')
======== End of example output (where/before crash/hang up occured ?) ========

So the example output ends (and update_dev_pkg is the last .Rd file alphabetically) and the last line in the log (with === around it verbatim) implies that the crash/hang happens later. Which is why I thought originally that the update.dev.pkg output was spurious.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 25, 2024
# data.table [v1.14.10](https://github.com/Rdatatable/data.table/milestone/20)

## NOTES

1. Maintainer of the package for CRAN releases is from now on Tyson
  Barrett (@TysonStanley),
  [#5710](Rdatatable/data.table#5710).

2. Updated internal code for breaking change of `is.atomic(NULL)` in
  R-devel,
  [#5691](Rdatatable/data.table#5691). Thanks to
  Martin Maechler for the patch.

3. Fix multiple test concerning coercion to missing complex numbers,
  [#5695](Rdatatable/data.table#5695) and
  [#5748](Rdatatable/data.table#5748). Thanks
  to @MichaelChirico and @ben-schwen for the patches.

4. Fix multiple format warnings (e.g., -Wformat)
  [#5712](Rdatatable/data.table#5712),
  [#5781](Rdatatable/data.table#5781),
  [#5880](Rdatatable/data.table#5800),
  [#5786](Rdatatable/data.table#5786). Thanks to
  @MichaelChirico and @jangorecki for the patches.



# data.table [v1.14.8](https://github.com/Rdatatable/data.table/milestone/28?closed=1)  (17 Feb 2023)

## NOTES

1. Test 1613.605 now passes changes to `as.data.frame()` in R-devel,
  [#5597](Rdatatable/data.table#5597). Thanks to
  Avraham Adler for reporting.

2. An out of bounds read when combining non-equi join with `by=.EACHI`
  has been found and fixed thanks to clang ASAN,
  [#5598](Rdatatable/data.table#5598). There
  was no bug or consequence because the read was followed (now preceded)
  by a bounds test.

3. `.rbind.data.table` (note the leading `.`) is no longer exported
  when `data.table` is installed in R>=4.0.0 (Apr 2020),
  [#5600](Rdatatable/data.table#5600). It was
  never documented which R-devel now detects and warns about. It is only
  needed by `data.table` internals to support R<4.0.0; see note 1 in
  v1.12.6 (Oct 2019) below in this file for more details.


# data.table [v1.14.6](https://github.com/Rdatatable/data.table/milestone/27?closed=1)  (16 Nov 2022)

## BUG FIXES

1. `fread()` could leak memory,
  [#3292](Rdatatable/data.table#3292). Thanks
  to @patrickhowerter for reporting, and Jim Hester for the fix. The fix
  requires R 3.4.0 or later. Loading `data.table` in earlier versions
  now highlights this issue on startup, asks users to upgrade R, and
  warns that we intend to upgrade `data.table`'s dependency from 8 year
  old R 3.1.0 (April 2014) to 5 year old R 3.4.0 (April 2017).

## NOTES

1. Test 1962.098 has been modified to pass latest changes to `POSIXt`
  in R-devel.

2. `test.data.table()` no longer creates `DT` in `.GlobalEnv`, a CRAN
  policy violation,
  [#5514](Rdatatable/data.table#5514). No
  other writes occurred to `.GlobalEnv` and release procedures have been
  improved to prevent this happening again.

3. The memory usage of the test suite has been halved,
  [#5507](Rdatatable/data.table#5507).


# data.table [v1.14.4](https://github.com/Rdatatable/data.table/milestone/26?closed=1)  (17 Oct 2022)

## NOTES

1. gcc 12.1 (May 2022) now detects and warns about an always-false
  condition (`-Waddress`) in `fread` which caused a small efficiency
  saving never to be invoked,
  [#5476](Rdatatable/data.table#5476). Thanks to
  CRAN for testing latest versions of compilers.

2. `update.dev.pkg()` has been renamed `update_dev_pkg()` to get out
  of the way of the `stats::update` generic function,
  [#5421](Rdatatable/data.table#5421). This is a
  utility function which upgrades the version of `data.table` to the
  latest commit in development which has passed all tests. As such we
  don't expect any backwards compatibility concerns. Its manual page was
  causing an intermittent hang/crash from `R CMD check` on Windows-only
  on CRAN which we hope will be worked around by changing its name.

3. Internal C code now passes `-Wstrict-prototypes` to satisfy the
  warnings now displayed on CRAN,
  [#5477](Rdatatable/data.table#5477).

4. `write.csv` in R-devel no longer responds to
  `getOption("digits.secs")` for `POSIXct`,
  [#5478](Rdatatable/data.table#5478). This
  caused our tests of `fwrite(, dateTimeAs="write.csv")` to fail on
  CRAN's daily checks using latest daily R-devel. While R-devel
  discussion continues, and currently it seems like the change is
  intended with further changes possible, this `data.table` release
  massages our tests to pass on latest R-devel. The idea is to try to
  get out of the way of R-devel changes in this regard until the new
  behavior of `write.csv` is released and confirmed. Package updates are
  not accepted on CRAN if they do not pass the latest daily version of
  R-devel, even if R-devel changes after the package update is
  submitted. If the change to `write.csv()` stands, then a future
  release of `data.table` will be needed to make `fwrite(,
  dateTimeAs="write.csv")` match `write.csv()` output again in that
  future version of R onwards. If you use an older version of
  `data.table` than said future one in the said future version of R,
  then `fwrite(, dateTimeAs="write.csv")` may not match `write.csv()` if
  you are using `getOption("digits.secs")` too. However, you can always
  check that your installation of `data.table` works in your version of
  R on your platform by simply running `test.data.table()`
  yourself. Doing so would detect such a situation for you: test 1741
  would fail in this case. `test.data.table()` runs the entire suite of
  tests and is always available to you locally. This way you do not need
  to rely on our statements about which combinations of versions of R
  and `data.table` on which platforms we have tested and support; just
  run `test.data.table()` yourself. Having said that, because test 1741
  has been relaxed in this release in order to be accepted on CRAN to
  pass latest R-devel, this won't be true for this particular release in
  regard to this particular test.

    ```R
    $ R --vanilla
    R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
    > DF = data.frame(A=as.POSIXct("2022-10-01 01:23:45.012"))
    > options(digits.secs=0)
    > write.csv(DF)
    "","A"
    "1",2022-10-01 01:23:45
    > options(digits.secs=3)
    > write.csv(DF)
    "","A"
    "1",2022-10-01 01:23:45.012

    $ Rdevel --vanilla
    R Under development (unstable) (2022-10-06 r83040) -- "Unsuffered Consequences"
    > DF = data.frame(A=as.POSIXct("2022-10-01 01:23:45.012"))
    > options(digits.secs=0)
    > write.csv(DF)
    "","A"
    "1",2022-10-01 01:23:45.012
    ```

5. Many thanks to Kurt Hornik for investigating potential impact of a
  possible future change to `base::intersect()` on empty input,
  providing a patch so that `data.table` won't break if the change is
  made to R, and giving us plenty of notice,
  [#5183](Rdatatable/data.table#5183).

6. `datatable.[dll|so]` has changed name to `data_table.[dll|so]`,
  [#4442](Rdatatable/data.table#4442). Thanks to
  Jan Gorecki for the PR. We had previously removed the `.` since `.` is
  not allowed by the following paragraph in the Writing-R-Extensions
  manual. Replacing `.` with `_` instead now seems more consistent with
  the last sentence.

    > ... the basename of the DLL needs to be both a valid file name
      and valid as part of a C entry point (e.g. it cannot contain
      ‘.’): for portable code it is best to confine DLL names to be
      ASCII alphanumeric plus underscore. If entry point R_init_lib is
      not found it is also looked for with ‘.’ replaced by ‘_’.


# data.table [v1.14.2](https://github.com/Rdatatable/data.table/milestone/24?closed=1)  (27 Sep 2021)

## NOTES

1. clang 13.0.0 (Sep 2021) requires the system header `omp.h` to be
  included before R's headers,
  [#5122](Rdatatable/data.table#5122). Many
  thanks to Prof Ripley for testing and providing a patch file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data.table::update.dev.pkg() Not working on Mac
3 participants