pimutils / pimutils/vdirsyncer

AttributeError: 'EmptyStreamReader' object has no attribute '_size'

Open
#919 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Python
Stars
1.9k
Forks
185
Avg merge
11h 49m
Merged PRs (30d)
1

Description

I filled a directory with .ics files, where the UID was the filename and therefore the UID ended in .ics. This resulted uploading files on the server, that end in .ics.ics. I deleted all files from a directory, and called

vdirsyncer -c config -vdebug sync --force-delete

This caused:

Deleting item e947872a-224b-4c84-8d25-90a541a9ec9-193.ics from mail_birthdays                                                                        [57/1995]
debug: Already normalized: '/dav/calendars/user/cal/birthdays/e947872a-224b-4c84-8d25-90a541a9ec9-193.ics.ics'                                                
warning: Deleting an item with no etag.                                                                                                                       
debug: ====================                                                                                                                                   
debug: DELETE http://127.0.0.3/dav/calendars/user/cal/birthdays/e947872a-224b-4c84-8d25-90a541a9ec9-193.ics.ics                                               
debug: {'User-Agent': 'vdirsyncer/0.18.1.dev50+g3e59a99', 'Content-Type': 'application/xml; charset=UTF-8', 'If-Match': '"3e45da6b5ba85bec7c95974ae55de7ea7770
46c4"'}                                                                                                                                                       
debug: None                                                                                                                                                   
debug: Sending request...                                                                                                                                     
debug: 204                                                                                                                                                    
debug: <CIMultiDictProxy('Date': 'Fri, 23 Jul 2021 11:13:52 GMT', 'Cache-Control': 'no-cache')>                                                               
--- Logging error ---                                                                                                                                         
Traceback (most recent call last):                                                                                                                            
  File "/usr/local/lib/python3.8/site-packages/click_log/core.py", line 51, in emit                                                                           
    msg = self.format(record)                                                                                                                                 
  File "/usr/local/lib/python3.8/logging/__init__.py", line 929, in format                                                                                    
    return fmt.format(record)                                                                                                                                 
  File "/usr/local/lib/python3.8/site-packages/click_log/core.py", line 37, in format                                                                         
    msg = record.getMessage()                                                                                                                                 
  File "/usr/local/lib/python3.8/logging/__init__.py", line 371, in getMessage                                                                                
    msg = str(self.msg)                                                                                                                                       
  File "/git/aiohttp/aiohttp/streams.py", line 132, in __repr__                                                                                               
    if self._size:                                                                                                                                            
AttributeError: 'EmptyStreamReader' object has no attribute '_size'                                                                                           
Call stack:                                                                                                                                                   
  File "/usr/local/bin/vdirsyncer", line 33, in <module>                                                                                                      
    sys.exit(load_entry_point('vdirsyncer==0.18.1.dev50+g3e59a99', 'console_scripts', 'vdirsyncer')())                                                        
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in __call__                                                                         
    return self.main(*args, **kwargs)                                                                                                                         
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main                                                                             
    rv = self.invoke(ctx)                                                                                                                                     
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1668, in invoke                                                                           
    return _process_result(sub_ctx.command.invoke(sub_ctx))                                                                                                   
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke                                                                           
    return ctx.invoke(self.callback, **ctx.params)                                                                                                            
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke                                                                            
    return __callback(*args, **kwargs)                                                                                                                        
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func                                                                     
    return ctx.invoke(f, obj, *args, **kwargs)                                                                                                                
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke                                                                            
    return __callback(*args, **kwargs)                                                                                                                        
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/cli/__init__.py", line 33, in inner                      
    f(*a, **kw)                                                                                                                                               
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/cli/__init__.py", line 152, in sync                      
    asyncio.run(main(collections))                                                                                                                            
  File "/usr/local/lib/python3.8/asyncio/runners.py", line 44, in run                                                                                         
    return loop.run_until_complete(main)                                                                                                                      
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 603, in run_until_complete                                                                     
    self.run_forever()                                                                                                                                        
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 570, in run_forever                                                                            
    self._run_once()                                                                                                                                          
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1859, in _run_once                                                                             
    handle._run()                                                                                                                                             
  File "/usr/local/lib/python3.8/asyncio/events.py", line 81, in _run                                                                                         
    self._context.run(self._callback, *self._args)                                                                                                            
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/cli/tasks.py", line 72, in sync_collection               
    await sync.sync(                                                                                                                                          
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/sync/__init__.py", line 158, in sync                     
    await action.run(a_info, b_info, conflict_resolution, partial_sync)                                                                                       
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/sync/__init__.py", line 181, in run                      
    await self._run_impl(a, b)                                                                                                                                
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/sync/__init__.py", line 249, in _run_impl                
    await self.dest.storage.delete(meta.href, meta.etag)                                                                                                      
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/storage/base.py", line 13, in inner                      
    return await f(self, *args, **kwargs)                                                                                                                     
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/storage/base.py", line 13, in inner                      
    return await f(self, *args, **kwargs)                                                                                                                     
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/storage/dav.py", line 602, in delete                     
    await self.session.request("DELETE", href, headers=headers)                                                                                               
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/storage/dav.py", line 413, in request                    
    return await http.request(method, url, session=session, **more)                                                                                           
  File "/usr/local/lib/python3.8/site-packages/vdirsyncer-0.18.1.dev50+g3e59a99-py3.8.egg/vdirsyncer/http.py", line 159, in request                           
    logger.debug(r.content)                                                                                                                                   
  File "/usr/local/lib/python3.8/logging/__init__.py", line 1434, in debug                                                                                    
    self._log(DEBUG, msg, args, **kwargs)                                                                                                                     
  File "/usr/local/lib/python3.8/logging/__init__.py", line 1589, in _log                                                                                     
    self.handle(record)
  File "/usr/local/lib/python3.8/logging/__init__.py", line 1599, in handle                                                                                   
    self.callHandlers(record)                                                                                                                                 
  File "/usr/local/lib/python3.8/logging/__init__.py", line 1661, in callHandlers                                                                             
    hdlr.handle(record)                                                                                                                                       
  File "/usr/local/lib/python3.8/logging/__init__.py", line 954, in handle                                                                                    
    self.emit(record)                                                                                                                                         
  File "/usr/local/lib/python3.8/site-packages/click_log/core.py", line 55, in emit                                                                           
    self.handleError(record)                                                                                                                                  
Unable to print the message and arguments - possible formatting error.                                                                                        
Use the traceback above to help find the error.                                                                                                               
Deleting item e947872a-224b-4c84-8d25-90a541a9ec7-9 from mail_oms                                                                                             

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in vdirsyncer/http.py at the request path that logs r.content, then trace the DELETE call from storage/dav.py. Reproduce the issue with vdirsyncer -c config -vdebug sync --force-delete against the described .ics setup and verify that the sync completes without the EmptyStreamReader logging error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.