neutron-server report 500 error when update floating ip port forwarding

Bug #1912596 reported by yangjianfeng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Unassigned

Bug Description

I create two floating ip port forwarding, like below:
# openstack floating ip port forwarding list 16c83a6f-8ab5-455f-a744-dccec61e408d -f value
6173dee8-8e7a-422f-bbb3-35e5726bf879 76a1f0d2-08ad-4975-a2ee-02d877960b35 192.168.5.4 7687 65530 udp None
fea45432-321b-4362-b2d4-525680a4b6d9 76a1f0d2-08ad-4975-a2ee-02d877960b35 192.168.5.4 65535 6554 tcp None

Then, I execute the below command to update one of them, like below:
# openstack floating ip port forwarding set 16c83a6f-8ab5-455f-a744-dccec61e408d fea45432-321b-4362-b2d4-525680a4b6d9 --internal-protocol-port 7687

The neutron server report 500 error:
HttpException: 500: Server Error for url: http://10.2.36.148:19696/v2.0/floatingips/16c83a6f-8ab5-455f-a744-dccec61e408d/port_forwardings/fea45432-321b-4362-b2d4-525680a4b6d9, Request Failed: internal server error while processing your request.

Revision history for this message
Slawek Kaplonski (slaweq) wrote :

Can You give us neutron-server log with the error which You have there? Probably there is some stacktrace in that log and that would be useful for us to triage this bug.

Changed in neutron:
status: New → Incomplete
tags: added: api l3-dvr-backlog
Revision history for this message
yangjianfeng (yangjianfeng) wrote :
Download full text (9.4 KiB)

Hi slawek, this is the error logs:
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api [req-4f675cb5-aa3a-4ade-8357-3b0437d64263 cb50cb5cb0fa42f485dc79a81a0249b1 f936cee5d7fb46c5980b2a47f4559c31 - default default] DB exceeded retry limit.: DBDuplicateEntry: (pymysql.err.IntegrityError) (1062, u"Duplicate entry '76a1f0d2-08ad-4975-a2ee-02d877960b35-192.168.5.4:7687' for key 'uniq_port_forwardings0internal_neutron_port_id0socket'") [SQL: u'UPDATE portforwardings SET socket=%(socket)s WHERE portforwardings.id = %(portforwardings_id)s'] [parameters: {'socket': '192.168.5.4:7687', 'portforwardings_id': u'fea45432-321b-4362-b2d4-525680a4b6d9'}] (Background on this error at: http://sqlalche.me/e/gkpj)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api Traceback (most recent call last):
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 142, in wrapper
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api return f(*args, **kwargs)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 183, in wrapped
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api LOG.debug("Retry wrapper got retriable exception: %s", e)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api self.force_reraise()
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api six.reraise(self.type_, self.value, self.tb)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 179, in wrapped
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api return f(*dup_args, **dup_kwargs)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron/api/v2/base.py", line 682, in _update
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api obj = obj_updater(request.context, id, **kwargs)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron/db/db_base_plugin_common.py", line 51, in inner
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api result = f(*args, **kwargs)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron/services/portforwarding/pf_plugin.py", line 400, in update_floatingip_port_forwarding
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api pf_obj.update()
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron/objects/base.py", line 342, in decorator
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api return func(self, *args, **kwargs)
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron/objects/base.py", line 876, in update
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api self._get_composite_keys()))
2021-01-21 16:04:14.182 1121930 ERROR oslo_db.api File "/usr/lib/python2.7/site-packages/neutron/objec...

Read more...

Revision history for this message
Slawek Kaplonski (slaweq) wrote :

Thx. So it seems that it don't properly catch db exception to return some nicer error message to the user in such case.
I think that this should be easy bug to fix. I will mark it as low-hanging-fruit for now.

tags: added: low-hanging-fruit
Changed in neutron:
status: Incomplete → Confirmed
importance: Undecided → Medium
Changed in neutron:
assignee: nobody → Mamatisa Nurmatov (isabek)
Revision history for this message
yangjianfeng (yangjianfeng) wrote :

Hi slawek, mamatisa:

I already committed a patch to fix it: https://review.opendev.org/c/openstack/neutron/+/771776

Changed in neutron:
assignee: Mamatisa Nurmatov (isabek) → nobody
Changed in neutron:
status: Confirmed → In Progress
Changed in neutron:
assignee: nobody → yangjianfeng (yangjianfeng)
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 16.3.1

This issue was fixed in the openstack/neutron 16.3.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 17.1.1

This issue was fixed in the openstack/neutron 17.1.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 18.0.0.0rc1

This issue was fixed in the openstack/neutron 18.0.0.0rc1 release candidate.

Revision history for this message
Slawek Kaplonski (slaweq) wrote : auto-abandon-script

This bug has had a related patch abandoned and has been automatically un-assigned due to inactivity. Please re-assign yourself if you are continuing work or adjust the state as appropriate if it is no longer valid.

Changed in neutron:
assignee: yangjianfeng (yangjianfeng) → nobody
tags: added: timeout-abandon
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/train)

Change abandoned by "Slawek Kaplonski <email address hidden>" on branch: stable/train
Review: https://review.opendev.org/c/openstack/neutron/+/774585
Reason: This review is > 4 weeks without comment, and failed Zuul jobs the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/stein)

Change abandoned by "Bernard Cafarelli <email address hidden>" on branch: stable/stein
Review: https://review.opendev.org/c/openstack/neutron/+/774489
Reason: train review is abandoned, don't hesitate to reopen this one if you still plan to work on it (and have train one fixed)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/train)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/774585
Committed: https://opendev.org/openstack/neutron/commit/3e06f40e3dfe3e39c4b13bebc3fe5ce1abb08cba
Submitter: "Zuul (22348)"
Branch: stable/train

commit 3e06f40e3dfe3e39c4b13bebc3fe5ce1abb08cba
Author: yangjianfeng <email address hidden>
Date: Sat Feb 6 02:13:04 2021 +0000

    Fix incorrect exception catch when update floating ip port forwarding

    Closes-Bug: #1912596
    Change-Id: Ib1a95dd41d25f39f3378a6728d752a6589b9b61c
    (cherry picked from commit e9e4395d578e40bb59272b409c7ca3617ec1e6e3)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/stein)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/774489
Committed: https://opendev.org/openstack/neutron/commit/b536fc0159ec107622eb3c855d555e32cd655aa4
Submitter: "Zuul (22348)"
Branch: stable/stein

commit b536fc0159ec107622eb3c855d555e32cd655aa4
Author: yangjianfeng <email address hidden>
Date: Sat Feb 6 02:13:04 2021 +0000

    Fix incorrect exception catch when update floating ip port forwarding

    Closes-Bug: #1912596
    Change-Id: Ib1a95dd41d25f39f3378a6728d752a6589b9b61c
    (cherry picked from commit e9e4395d578e40bb59272b409c7ca3617ec1e6e3)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (stable/rocky)

Change abandoned by "yangjianfeng <email address hidden>" on branch: stable/rocky
Review: https://review.opendev.org/c/openstack/neutron/+/774590

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron stein-eol

This issue was fixed in the openstack/neutron stein-eol release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron train-eol

This issue was fixed in the openstack/neutron train-eol release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.