Skip to content

Fix crashes from HtmlDiff in final review #67

@kmccurley

Description

@kmccurley

I found an example where calculating HtmlDiff in admin.py::final_review() went into an infinite loop and eventually caused the apache process to time out. In the case that caused the error, it was trying to compare crypto.bib from cryptobib with another small file of the same name, and it ran out of RAM. There is apparently a known problem in HtmlDiff. The solution is not obvious, but I can think of several approaches:

  1. give up on calculating diffs. This would be unfortunate.
  2. only calculate diffs when the files are both small. This has the unfortunate requirement to stat() every file, but would be safer.
  3. only calculate diffs when the files are "relatively close in size". I'm not sure what that would be.
  4. use a second process to timeout the calculation of HtmlDiff. See https://medium.com/@chaoren/how-to-timeout-in-python-726002bf2291 for a way to do this. This seems clumsy but would probably be safe.

Metadata

Metadata

Assignees

Labels

PrioritybugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions