AttibuteError: 'Tensor' object has no attribute 'append'

Hi all
sorry for cross-posting 'Tensor' object has no attribute 'append' · Issue #3385 · fastai/fastai · GitHub

fastai version 2.2.5.

I am running a (flask) web app that does inference (image classification) with fastai.
Everything works fine if the images are given to the app sequentially.
When several requests to the app happen (almost) simultaneously, the app fails with the error:

AttibuteError: 'Tensor' object has no attribute 'append'

Here is a longer stacktrace:

    klass, idx, probs = self.model.predict(img)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 256, in predict
    inp,preds,_,dec_preds = self.get_preds(dl=dl, with_input=True, with_decoded=True)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 243, in get_preds
    self._do_epoch_validate(dl=dl)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 193, in _do_epoch_validate
    with torch.no_grad(): self._with_events(self.all_batches, 'validate', CancelValidException)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 160, in _with_events
    try: self(f'before_{event_type}');  f()
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 166, in all_batches
    for o in enumerate(self.dl): self.one_batch(*o)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 184, in one_batch
    self._with_events(self._do_one_batch, 'batch', CancelBatchException)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 162, in _with_events
    self(f'after_{event_type}');  final()
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 141, in __call__
    def __call__(self, event_name): L(event_name).map(self._call_one)
  File "/zzz/venv/lib/python3.6/site-packages/fastcore/foundation.py", line 154, in map
    def map(self, f, *args, gen=False, **kwargs): return self._new(map_ex(self, f, *args, gen=gen, **kwargs))
  File "/zzz/venv/lib/python3.6/site-packages/fastcore/basics.py", line 666, in map_ex
    return list(res)
  File "/zzz/venv/lib/python3.6/site-packages/fastcore/basics.py", line 651, in __call__
    return self.func(*fargs, **kwargs)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/learner.py", line 145, in _call_one
    for cb in self.cbs.sorted('order'): cb(event_name)
  File "/zzz/venv/lib/python3.6/site-packages/fastai/callback/core.py", line 44, in __call__
    if self.run and _run: res = getattr(self, event_name, noop)()
  File "/zzz/venv/lib/python3.6/site-packages/fastai/callback/core.py", line 122, in after_batch
    if self.save_preds is None: self.preds.append(preds)

The model is loaded with load_learner().
The last thing that happens is a call to a Callback after_batch.
It looks to (unexperienced) me as if two different processes try to access the same memory simultaneously.

The issue is reproducible both on GPU and CPU.

I would appreciate any hints how it can be overcome. Thanks in advance.