Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1455457

Summary: cdn-sync doesn't quit gracefully when connection to the Satellite 5 server closed
Product: Red Hat Satellite 5 Reporter: Radovan Drazny <rdrazny>
Component: Satellite SynchronizationAssignee: Jan Dobes <jdobes>
Status: CLOSED DEFERRED QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 08:43:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1450940    

Description Radovan Drazny 2017-05-25 08:58:03 UTC
Description of problem:
This bug is based on BZ 1434471. If Satellite server is stopped during the cdn-sync, the sync process continues to 100% progress, and ends with flurry of cursor errors and finally a traceback. 

Version-Release number of selected component (if applicable):
spacewalk-backend-cdn-2.5.3-133

How reproducible:


Steps to Reproduce:
1. Sync some big channel from the CDN
2. Wait for the "Importing packages" phase to run
3. Stop the Satellite server

Actual results:
Importing packages goes all the way to 100% mark (takes a few minutes, not too long), and then there is following ouptut:

Importing packages:     |##################################################| 100.0%
13:48:21 Linking packages to channel.
13:48:22 ERROR: cursor already closed
13:48:22 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.9/x86_64/kickstart
13:48:25 ERROR: cursor already closed
13:48:25 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.8/x86_64/kickstart
13:48:26 ERROR: cursor already closed
13:48:26 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.6/x86_64/kickstart
13:48:27 ERROR: cursor already closed
13:48:27 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.3/x86_64/kickstart
13:48:28 ERROR: cursor already closed
13:48:28 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.1/x86_64/kickstart
13:48:29 ERROR: cursor already closed
13:48:29 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.4/x86_64/kickstart
13:48:30 ERROR: cursor already closed
13:48:30 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.7/x86_64/kickstart
13:48:31 ERROR: cursor already closed
13:48:31 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.2/x86_64/kickstart
13:48:32 ERROR: cursor already closed
13:48:32 Repo URL: https://cdn.redhat.com/content/dist/rhel/server/6/6.5/x86_64/kickstart
13:48:33 ERROR: cursor already closed
Traceback (most recent call last):
  File "/usr/bin/cdn-sync", line 219, in <module>
    sys.exc_info()[2])
  File "/usr/bin/cdn-sync", line 164, in <module>
    error_messages = cdnsync.sync(channels=args.channel)
  File "/usr/lib/python2.6/site-packages/spacewalk/cdn_tools/cdnsync.py", line 466, in sync
    cur_time, failed_packages = self._sync_channel(channel)
  File "/usr/lib/python2.6/site-packages/spacewalk/cdn_tools/cdnsync.py", line 407, in _sync_channel
    return sync.sync()
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/reposync.py", line 484, in sync
    """, channel_id=int(self.channel['id'])) or []
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/__init__.py", line 291, in fetchall_dict
    h = prepare(sql)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/__init__.py", line 270, in prepare
    return db.prepare(sql, blob_map=blob_map)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 224, in prepare
    return Cursor(dbh=self.dbh, sql=sql, force=force, blob_map=blob_map)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 270, in __init__
    sql_base.Cursor.__init__(self, dbh, sql, force)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 113, in __init__
    self._real_cursor = self._prepare(force=force)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 124, in _prepare
    cursor = self._prepare_sql()
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 281, in _prepare_sql
    cursor = self.dbh.cursor()
Exception: SYNC ERROR: attempting to display as much information as possible
 connection already closed

After restarting the Satellite server, the synced channel is present, but is't empty.

Expected results:
Graceful exit from the sync process, no traceback.

Additional info:

Comment 1 Tomas Lestach 2018-04-10 08:43:04 UTC
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog.

This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED.