You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using this app with EFS persistent storage, if you insert a new product into the product catalogue with a space character in the product name, then the app will break.
On line 137, the new product is written to the file on EFS: f.write('{} {}'.format(id, request.json['name']))
So if e.g. id = "121", and request.json['name'] contains "Brown shoes", the result written to file is "121 Brown shoes"
When reading from the storage, on line 71 it reads the contents of the file line by line with: (key, val) = line.split()
But in Python, this will thrown and error if the line contains more than 2 values: "ValueError: too many values to unpack (expected 2)"
Seems that this error is not handled properly in the application and the application will crash/hang due to this.
One option is to replace:
(key, val) = line.split()
with:
(key, val) = line.split(" ",1)
To make sure it splits the line into exactly 2 parts. But I haven't verified if this causes any further problems upstream when val returned is "Brown shoes" (including a space). Hopefully someone has the time and interest to test & investigate this further?
The text was updated successfully, but these errors were encountered:
The problem is here: https://github.com/aws-containers/eks-app-mesh-polyglot-demo/blob/master/workshop/apps/product_catalog/app_efs.py
When using this app with EFS persistent storage, if you insert a new product into the product catalogue with a space character in the product name, then the app will break.
On line 137, the new product is written to the file on EFS: f.write('{} {}'.format(id, request.json['name']))
So if e.g. id = "121", and request.json['name'] contains "Brown shoes", the result written to file is "121 Brown shoes"
When reading from the storage, on line 71 it reads the contents of the file line by line with: (key, val) = line.split()
But in Python, this will thrown and error if the line contains more than 2 values: "ValueError: too many values to unpack (expected 2)"
Seems that this error is not handled properly in the application and the application will crash/hang due to this.
One option is to replace:
(key, val) = line.split()
with:
(key, val) = line.split(" ",1)
To make sure it splits the line into exactly 2 parts. But I haven't verified if this causes any further problems upstream when val returned is "Brown shoes" (including a space). Hopefully someone has the time and interest to test & investigate this further?
The text was updated successfully, but these errors were encountered: