Opened 18 months ago

Closed 9 months ago

#30351 closed defect (fixed)

Unknown error in prepare_* functions using the spread() function

Reported by: karsten Owned by: metrics-team
Priority: High Milestone:
Component: Metrics/Website Version:
Severity: Normal Keywords:
Cc: metrics-team Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

This morning we received a report that some of the graphs are not working anymore.

Turns out that nine graphs were affected by this issue, all of which using the spread() function internally. Here's the error message when plotting one of these graphs:

Error in get("as_data_frame.matrix", asNamespace("tibble"), mode = "function") :
  object 'as_data_frame.matrix' of mode 'function' was not found
Calls: plot_webstats_tm ... NextMethod -> spread_.data.frame -> as_data_frame_matrix -> get

I came up with a hotfix that replaces spread() with cast(), but that's going backwards from the tidyr package to its predecessor, the reshape package.

Also, I didn't find a working fix for the Tor Messenger graph where cast() works slightly different than spread() with regard to missing data.

We'll need to find a better fix. Ideally, we'd find out why spread() isn't working anymore, including why it stopped working in the first place.

Child Tickets

Change History (8)

comment:1 Changed 18 months ago by karsten

I tweaked the hotfix to also work for Tor Messenger (by using the reshape2 package rather than reshape): https://gitweb.torproject.org/user/karsten/metrics-web.git/commit/?h=task-30351&id=b3e80fce17f04cf7c83ef3843d2de0cc3bfef389

This is currently running on the server but not merged to master. Ideally, we'd find a better fix!

comment:2 Changed 18 months ago by karsten

I just pushed this hotfix to master, because I was about to make another, unrelated hotfix. We should still find a better fix for this issue, which is why I'm leaving this ticket open.

comment:3 Changed 9 months ago by anarcat

do you happen to know if this could be related to the weird database crashes I've seen recently in #32692?

comment:4 Changed 9 months ago by karsten

No database involved here. And no, it's unrelated, as I can reproduce the issue in a local VM.

comment:5 Changed 9 months ago by karsten

Changing priority of all defects in Metrics/Website to high to get these resolved soon.

comment:6 Changed 9 months ago by karsten

Status: newneeds_review

The spread() function works fine again using buster's r-cran-tidyr 0.8.2-1 package, whereas it was previously broken with stretch's r-cran-tidyr 0.6.1-1 package.

Please review commit ca90cf1 in my task-30351 branch.

comment:7 Changed 9 months ago by irl

Status: needs_reviewmerge_ready

LGTM.

comment:8 Changed 9 months ago by karsten

Resolution: fixed
Status: merge_readyclosed

Thanks! Merged to master and deployed. Closing.

Note: See TracTickets for help on using tickets.