alexa / alexa-smart-screen-sdk

⛔️ DEPRECATED Active at https://github.com/alexa/avs-device-sdk
Apache License 2.0
76 stars 25 forks source link

ASCII strings converted as UTF-8 strings #100

Closed VictorFrench closed 3 years ago

VictorFrench commented 3 years ago

we have seen inconsistency in GUI for player info card and tell me a joke.

  1. When we click on left/right buttons, we don't see focus changing on the navigation icons
  2. For Tell me a joke, text was not seen but reading joke is working.

we found the SSSDK/APL core modules from where messages related to backgroundColor and scrolling position are sent to GUI client(index.html). we have seen the strings are converted as UTF-8 strings (as shown below). Root cause for the issue is because of JSON key corruption (eg: backgroundColor,_scrollPosition etc). What could be the root cause for this issue. How to identify which module corrupting the JSON keys.

PFA logs and source files where we have added prints for reference.

From logs: [2021-07-14 11:18:23.869] AplCoreConnectionManager::processDirty update {"id":":1052","backgroundCo\u0002\u0000\u0000":"#00000000"} [2021-07-14 11:18:23.804] AplCoreConnectionManager::processDirty update {"id":":1037","_notify_childrenChan\u0002\u0000\u0000":[]} [2021-07-14 11:46:03.885] AplCoreConnectionManager::processDirty update {"id":":1002","_notify_childrenChanged":[],"_scrollPosit\u0002\u0000\u0000":162.5}

What is the expected behavior?

JSON key value should not be corrupted.

What behavior are you observing?

JSON key value is corrupted.

Tell us about your environment:

AVS SDK - 1.24.0 SS SDK - 2.7.0 APL CORE - 1.6.1 OS - Linux

What version of the AVS Device SDK are you using?

  1.24.0

Tell us what hardware you're using:

     Other 

Tell us about your OS (Type & version):

Have you tried the same use case with AVS Device SDK SampleApp?

The issue is not reproducible on the AVS Device SDK SampleApp.
sngoc-amazon commented 3 years ago

Hi @VictorFrench,

Thanks for bringing this issue to our attention.

Just to clarify, is Player Info card and "Tell me a Joke" issues related? If they are unrelated, please open another issue for "Tell me a joke" to help us understand and root cause the problem.

For first issue, "When we click on left/right buttons, we don't see focus changing on the navigation icons", can you confirm the steps for reproducing this behavior and specify where grey background/focus is being seen on (if any):

  1. On initial render of music player
  2. When left arrow is pressed
VictorFrench commented 3 years ago

Hi @sngoc-amazon,

Thanks for the reply. Both Player info card and tell me a joke issues are JSON key corruption problem.

  1. On initial render of music player ==> focus present on pause button
  2. When left arrow is pressed ==> focus not changing from pause button. If we press Enter after Left key, previous song starts playing. When we add logs in GUIClient::executeWriteMessage/AplCoreConnectionManager::processDirty seen that backgroundColor string getting corrupted as backgroundCo\u0002\u0000\u0000.

As mentioned in issue description, for Tell me a joke also _scrollPosition field corruption seen,

sngoc-amazon commented 3 years ago

I'm unable to reproduce this issue on my end. Can you share the SmartScreenSDKConfig.json file you are using?

Can you also try changing the following line in APLCoreEngine/aplcore/src/primitives/object.cpp, Object::serialize function to see if you are still experience the same issue:

case kAbsoluteDimensionType:
        return rapidjson::Value(mU.value);

to

case kAbsoluteDimensionType:
        return rapidjson::Value(std::isfinite(mU.value) ? mU.value : 0);
VictorFrench commented 3 years ago

@sngoc-amazon ,

          Please find attached SmartScreenSDKConfig.json.
          I have tried by doing above mentioned change in object.cpp, still corruption issue seen. 

SmartScreenSDKConfig.zip

rpalkar-amzn commented 3 years ago

Hi @VictorFrench

Thank you for the reply. Few clarifying questions about the issue:

  1. Is the understanding correct that the key printed from CoreComponent::serializeDirty is correct as expected but the value gets corrupted when this block is executed?
  2. Does the path specified for -DAPLCORE_RAPIDJSON_INCLUDE_DIR in CMake of Smart Screen SDK point to apl-core-library/build/rapidjson-prefix/src/rapidjson/include. Could you share the CMake command used for build?

Also, could you please add more logs and provide a log file for the issue:

VictorFrench commented 3 years ago

@sngoc-amazon & @rpalkar-amzn , This issue is not seen after compiling sample app with apl-core-library/build/rapidjson-prefix/src/rapidjson/include.

Thanks a lot for the support.!!

VictorFrench commented 3 years ago

@sngoc-amazon/ @rpalkar-amzn , We have seen that incase of AVS SDK, when we run make install rapidjson include folder copied to the INSTALL_PREFIX path. That is not the case in SSSDK. We are compiling SSSDK sample app separately with patches specific to the our platform. In this cases it is difficult to trace back includes in build folder. Is it possible to add respective make file changes in future release to copy include folders into INSTALL_PREFIX path.

nguymi91 commented 3 years ago

@VictorFrench

We will evaluate this suggestion and consider it for our future releases. Please reopen the ticket if needed.