REST API: The cloud instance is returning “500 Internal Server Error” when accessing the “/Employees GET” and “/Users GET” endpoints and specifying multiple fields via the “fields” URL parameter

Only when accessing the “/Employees GET” and “/Users GET” endpoints and specifying almost all the available fields via the “fields” URL parameter, the server is responding with the “500 Internal Server Error”. No additional information is provided.

For example, the request as below will fail.

GET /rest/v11/Users?max_num=1000&fields=id,user_name,user_hash,system_generated_password,pwd_last_changed,authenticate_id,sugar_login,picture,first_name,last_name,full_name,name,is_admin,external_auth_only,receive_notifications,send_email_on_mention,description,date_entered,date_modified,last_login,modified_user_id,modified_by_name,created_by,created_by_name,title,department,phone_home,phone_mobile,phone_work,phone_other,phone_fax,status,address_street,address_city,address_state,address_country,address_postalcode,usertype,license_type,default_team,team_id,team_set_id,acl_team_set_id,business_center_name,business_center_id,team_count,team_name,deleted,portal_only,show_on_employees,employee_status,messenger_id,messenger_type,reports_to_id,reports_to_name,email1,email,email_link_type,is_group,c_accept_status_fields,accept_status_id,accept_status_name,accept_status_calls,accept_status_messages,preferred_language,acl_role_set_id,site_user_id,cookie_consent,cookie_consent_received_on,sync_key,previously_licensed_c,customer_journey_access,customer_journey_last_active

On the other hand, when removing the accept_status_messages field only, the request as below will work fine.

GET /rest/v11/Users?max_num=1000&fields=id,user_name,user_hash,system_generated_password,pwd_last_changed,authenticate_id,sugar_login,picture,first_name,last_name,full_name,name,is_admin,external_auth_only,receive_notifications,send_email_on_mention,description,date_entered,date_modified,last_login,modified_user_id,modified_by_name,created_by,created_by_name,title,department,phone_home,phone_mobile,phone_work,phone_other,phone_fax,status,address_street,address_city,address_state,address_country,address_postalcode,usertype,license_type,default_team,team_id,team_set_id,acl_team_set_id,business_center_name,business_center_id,team_count,team_name,deleted,portal_only,show_on_employees,employee_status,messenger_id,messenger_type,reports_to_id,reports_to_name,email1,email,email_link_type,is_group,c_accept_status_fields,accept_status_id,accept_status_name,accept_status_calls,preferred_language,acl_role_set_id,site_user_id,cookie_consent,cookie_consent_received_on,sync_key,previously_licensed_c,customer_journey_access,customer_journey_last_active

Based on the SugarCRM logs as below, I can see that including multiple related fields may cause the request to exceed the allowed memory size configured for the SugarCRM server.

Stack trace:
#0 [internal function]: sugar_cleanup()
#1 {main}
Mon Dec 20 15:57:57 2021 [30057][1][FATAL] Uninstalling a package Moving Dates Script because of the fatal error
Mon Dec 20 15:57:57 2021 [30057][1][FATAL] ErrorException: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 8192 bytes) in /mnt/sugar/11.2.0/ent/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php:357

Is this behavior expected, or is this an issue with the latest version of the SugarCRM. This wasn't happening with the previous versions of SugarCRM. Any suggestion on this on how to get all the fields for the Employees and Users entities would be really helpful.