Skip to content
This repository was archived by the owner on May 7, 2025. It is now read-only.
This repository was archived by the owner on May 7, 2025. It is now read-only.

App crashes/hangs when using space characters in product names and using EFS persistent storage #47

@marvliet

Description

@marvliet

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions