text:
[General]

Hello Folks,
I have been trying to get green grass discovery demo working on ESP32-WROVER hardware but couldn't not get any resource of green grass device v2.
Hardwares Used:

Raspberry Pi3 [RPi]
ESP32-WROVER

Steps I followed to setup GGC on RPi:

Setup Raspberry Pi with Raspbian buster and installed Java
Created a user on AWS IAM console with policies i.e.

IAMFullAccess
AmazonS3FullAccess
AWSGreengrassFullAccess
AWSIoTFullAccess

Downloaded AWS Secret Key and AWS Access Key of user
Exported AWS Secret Key and AWS Access Key in RPi
Setup green grass core device in RPi [https://docs.aws.amazon.com/greengrass/v2/developerguide/getting-started.html]
Downloaded green grass installer, run it and successfully installed Nucleus as system service in RPi
Checked and verified by command : sudo /greengrass/v2/bin/greengrass-cli component list
and it was showing aws.greengrass.cli component's status as Running
Then added a new component for publish and subscribe to AWS IoT core by creating recipes and artifacts. Component was deployed and successfully running. I could publish and subscribe to AWS IoT core.

Steps I followed to setup GGC Discovery Demo on ESP32:

Setup python and python-pip on windows PC
Downloaded AWS CLI and installed on windows PC
Configured AWS user configuration using command : aws configure and configured AWS Access Key, AWS Secret Key, Region and default data format [json].
Cloned amazon-freertos
git clone https://github.com/aws/amazon-freertos.git --recurse-submodules
cd amazon-freertos
git fetch --all –tags
Installed ESP-IDF dependencies : amazon-freertos/vendors/espressif/esp-idf & run:
install.bat
Setup ESP-IDF environment: amazon-freertos/vendors/espressif/esp-idf & run:
export.bat
Setup AWS configuration i.e. Things name, Wi-Fi SSID and Password in configure.json from amazon-freertos/tools/aws_config_quick_start path
Run : python SetupAWS.py setup to setup thing and AWS credentials
Run:  python SetupAWS.py update_creds to update AWS credentials
Replaced CONFIG_CORE_MQTT_MUTUAL_AUTH_DEMO_ENABLED with the CONFIG_GREENGRASS_DISCOVERY_DEMO_ENABLED in vendors/espressif/boards/esp32/aws_demos/config_files/aws_demo_config.h
In amazon-freertos root directory: built demo using below command
**idf.py -DVENDOR=espressif -DBOARD=esp32_wrover_kit -DCOMPILER=xtensa-esp32 build**
12 .Flashed and monitored firmware using idf.py -p COM3 flash monitor

But not getting green grass device information 😕 Don't know what was the mistake !
Attaching logs of ESP32 monitoring.
Can anyone point me about the possible issue/s and probably solution !?
Thanks.
Jitendra
Hard resetting via RTS pin...
Executing action: monitor
Running idf_monitor in directory c:\amazon-freertos
Executing "C:\Users\Jitendra\.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe C:\amazon-freertos\vendors\espressif\esp-idf\tools/idf_monitor.py -p COM5 -b 115200 --toolchain-prefix xtensa-esp32-elf- c:\amazon-freertos\build\aws_demos -m 'C:\Users\Jitendra\.espressif\python_env\idf4.2_py3.8_env\Scripts\python.exe' 'C:\amazon-freertos\vendors\espressif\esp-idf\tools\idf.py' '-p' 'COM5'"...
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM5 instead...
C:\amazon-freertos\vendors\espressif\esp-idf\tools/idf_monitor.py:474: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(serial.VERSION) < StrictVersion('3.3.0'):
--- idf_monitor on \\.\COM5 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:7488
load:0x40078000,len:13724
load:0x40080400,len:4584
0x40080400: _init at ??:?

entry 0x400806f4
I (26) boot: ESP-IDF v4.2.2-273-g9e3992ead 2nd stage bootloader
I (27) boot: compile time 17:47:09
I (27) boot: chip revision: 1
I (31) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (38) boot.esp32: SPI Speed      : 40MHz
I (42) boot.esp32: SPI Mode       : DIO
I (47) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (57) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (68) boot:  0 nvs              WiFi data        01 02 00010000 00006000
I (75) boot:  1 otadata          OTA data         01 00 00016000 00002000
I (83) boot:  2 phy_init         RF data          01 01 00018000 00001000
I (90) boot:  3 ota_0            OTA app          00 10 00020000 00177000
I (98) boot:  4 ota_1            OTA app          00 11 001a0000 00177000
I (105) boot:  5 storage          WiFi data        01 02 00317000 00010000
I (113) boot: End of partition table
I (117) boot: ota rollback check done
I (121) boot_comm: chip revision: 1, min. application chip revision: 0
I (128) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x28528 (165160) map
I (200) esp_image: segment 1: paddr=0x00048550 vaddr=0x3ffbdb60 size=0x03994 ( 14740) load
I (207) esp_image: segment 2: paddr=0x0004beec vaddr=0x40080000 size=0x0412c ( 16684) load
0x40080000: _WindowOverflow4 at c:\amazon-freertos\build/../freertos_kernel/portable/ThirdParty/GCC/Xtensa_ESP32/xtensa_vectors.S:1860

I (214) esp_image: segment 3: paddr=0x00050020 vaddr=0x400d0020 size=0xa8cf0 (691440) map
0x400d0020: _stext at ??:?

I (479) esp_image: segment 4: paddr=0x000f8d18 vaddr=0x4008412c size=0x18b70 (101232) load
0x4008412c: coex_core_release at ??:?

I (539) boot: Loaded app from partition at offset 0x20000
I (539) boot: Disabling RNG early entropy source...
I (540) cpu_start: Pro cpu up.
I (543) cpu_start: Application information:
I (548) cpu_start: Project name:     amazon-freertos
I (554) cpu_start: App version:      1
I (558) cpu_start: Compile time:     Feb  3 2022 17:46:30
I (564) cpu_start: ELF file SHA256:  79aa8361c3c5bbb5...
I (570) cpu_start: ESP-IDF:          v4.2.2-273-g9e3992ead
I (576) cpu_start: Single core mode
I (581) heap_init: Initializing. RAM available for dynamic allocation:
I (588) heap_init: At 3FF80000 len 00002000 (8 KiB): RTCRAM
I (594) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (600) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (606) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (612) heap_init: At 3FFCAD38 len 000152C8 (84 KiB): DRAM
I (619) heap_init: At 3FFE0440 len 0001FBC0 (126 KiB): D/IRAM
I (625) heap_init: At 40078000 len 00008000 (32 KiB): IRAM
I (631) heap_init: At 4009CC9C len 00003364 (12 KiB): IRAM
I (637) cpu_start: Pro cpu start user code
I (655) spi_flash: detected chip: generic
I (656) spi_flash: flash io0 0 [main] Initializing lwIP TCP stack

I (676) PKCS11: Initializing NVS partition: "storage"
E (686) PKCS11: failed nvs get file size 4354 0
1 9 [main] Write certificate...

2 22 [iot_thread] [INFO ][DEMO][220] ---------STARTING DEMO---------

I (886) BTDM_INIT: BT controller compile version [bfbbe1e]
3 22 [iot_thread] [INFO ][INIT][220] SDK successfully initialized.

I (896) system_api: Base MAC address is not set
I (896) system_api: read default base MAC address from EFUSE
I (906) phy_init: phy_version 4660,0162888,Dec 23 2020
GAP procedure initiated: advertise; disc_mode=2 adv_channel_map=0 own_addr_type=0 adv_filter_policy=0 adv_itvl_min=187 adv_itvl_max=375
I (1306) wifi:wifi driver task: 3ffd9374, prio:23, stack:6656, core=0
I (1306) wifi:wifi firmware version: df5b09d
I (1306) wifi:wifi certification version: v7.0
I (1306) wifi:config NVS flash: enabled
I (1306) wifi:config nano formating: disabled
I (1316) wifi:Init data frame dynamic rx buffer num: 32
I (1316) wifi:Init management frame dynamic rx buffer num: 32
I (1326) wifi:Init management short buffer num: 32
I (1326) wifi:Init dynamic tx buffer num: 32
I (1336) wifi:Init static rx buffer size: 1600
I (1336) wifi:Init static rx buffer num: 10
I (1336) wifi:Init dynamic rx buffer num: 32
I (1346) wifi_init: rx ba win: 6
I (1346) wifi_init: tcpip mbox: 32
I (1356) wifi_init: udp mbox: 6
I (1356) wifi_init: tcp mbox: 6
I (1356) wifi_init: tcp tx win: 5744
I (1366) wifi_init: tcp rx win: 5744
I (1366) wifi_init: tcp mss: 1440
I (1376) wifi_init: WiFi IRAM OP enabled
I (1376) wifi_init: WiFi RX IRAM OP enabled
I (1386) phy_init: phy_version 4660,0162888,Dec 23 2020
I (1396) wifi:mode : sta (24:0a:c4:44:92:8c)
I (1396) WIFI: WIFI_EVENT_STA_START
I (2656) wifi:new:<6,0>, old:<1,0>, ap:<255,255>, sta:<6,0>, prof:1
I (3136) wifi:state: init -> auth (b0)
I (3156) wifi:state: auth -> assoc (0)
I (3156) wifi:state: assoc -> run (10)
I (3206) wifi:connected with Jitendra, aid = 4, channel 6, BW20, bssid = 86:4e:3e:ab:db:52
I (3206) wifi:security: WPA2-PSK, phy: bgn, rssi: -41
I (3206) wifi:pm start, type: 1

I (3216) WIFI: WIFI_EVENT_STA_CONNECTED
I (3266) wifi:AP's beacon interval = 102400 us, DTIM period = 2
I (4166) esp_netif_handlers: sta ip: 192.168.136.84, mask: 255.255.255.0, gw: 192.168.136.65
I (4166) WIFI: SYSTEM_EVENT_STA_GOT_IP
4 350 [sys_evt] [INFO ][DEMO][3500] Connected to WiFi access point, ip address: 255.255.255.0.

5 350 [iot_thread] [INFO ][DEMO][3500] Successfully initialized the demo. Network type for the demo: 1

6 350 [iot_thread] [aws_greengrass_discovery_demo.c:533] [INFO] [Greengrass_Discovery_Demo] Attempting automated selection of Greengrass device

E (4886) PKCS11: failed nvs get file size 4354 0
7 773 [iot_thread] JSON file retrieval completed

8 773 [iot_thread] About to close socket.

9 773 [iot_thread] Socket closed.

10 773 [iot_thread] Stack high watermark for discovery helper task: 7912.

11 773 [iot_thread] JSON parsing: Couldn't find certificate

12 773 [iot_thread] [aws_greengrass_discovery_demo.c:606] [ERROR] [Greengrass_Discovery_Demo] Auto-connect: Failed to retrieve Greengrass address and certificate.

13 773 [iot_thread] [INFO ][DEMO][7730] memory_metrics::freertos_heap::before::bytes::215244

14 773 [iot_thread] [INFO ][DEMO][7730] memory_metrics::freertos_heap::after::bytes::81876

15 774 [iot_thread] [INFO ][DEMO][7730] memory_metrics::demo_task_stack::before::bytes::11992

16 774 [iot_thread] [INFO ][DEMO][7740] memory_metrics::demo_task_stack::after::bytes::7112

I (9406) wifi:state: run -> init (0)
I (9406) wifi:pm stop, total sleep time: 3744775 us / 6192357 us

I (9406) wifi:new:<6,0>, old:<6,0>, ap:<255,255>, sta:<6,0>, prof:1
I (9406) WIFI: WIFI_EVENT_STA_DISCONNECTED: 63
17 874 [iot_thread] [ERROR][DEMO][8740] Error running demo.

E (9416) wifi_init: Wi-Fi not stop
I (9426) WIFI: WIFI_EVENT_STA_STOP
I (9426) wifi:flush txq
I (9426) wifi:stop sw txq
I (9436) wifi:lmac stop hw txq
I (9436) wifi:Deinit lldesc rx mblock:10
GAP procedure initiated: stop advertising.
GAP procedure initiated: stop advertising.
18 879 [iot_thread] [INFO ][INIT][8790] SDK cleanup done.

19 879 [iot_thread] [INFO ][DEMO][8790] -------DEMO FINISHED-------

That would be really helpful.
Thanks.

Hi, did you enable cloud discovery for the Greengrass core? If not, see docs to enable it here.
Let me know if this does not solve your issue.

Hi,
I already enabled cloud discovery for the greengrass core.
Though I did some debugging and came to know that device getting greengrass core information but somehow it was not able to connect to that.
It always failed in GGD_SecureConnect_Connect function in aws_helper_secure_connect.c file specifically in SOCKETS_Connect in  GGD_SecureConnect_Connect function.
`BaseType_t GGD_SecureConnect_Connect( const GGD_HostAddressData_t * pxHostAddressData,
                                      Socket_t * pxSocket,
                                      uint32_t ulReceiveTimeOut,
                                      uint32_t ulSendTimeOut )
{
    const TickType_t xReceiveTimeOut = pdMS_TO_TICKS( ulReceiveTimeOut );
    const TickType_t xSendTimeOut = pdMS_TO_TICKS( ulSendTimeOut );
    SocketsSockaddr_t xServerAddress;
    size_t xURLLength;
    BaseType_t xIsIPAddress;
    BaseType_t xStatus;
    int32_t returnCode;

    configASSERT( pxHostAddressData != NULL );
    configASSERT( pxSocket != NULL );

    /* Calculate the length of the supplied URL. */
    xURLLength = strlen( pxHostAddressData->pcHostAddress );

    /* Ensure that the length of the specified URL is
     * within the permitted limits. */
    if( xURLLength <= ( size_t ) securesocketsMAX_DNS_NAME_LENGTH )
    {
        printf("1111");
        /* Create the socket. */
        *pxSocket = SOCKETS_Socket( SOCKETS_AF_INET,
                                    SOCKETS_SOCK_STREAM,
                                    SOCKETS_IPPROTO_TCP );

        if( *pxSocket == SOCKETS_INVALID_SOCKET )
        {
            xStatus = pdFAIL;
            printf("2222");
        }
        else
        {
            xStatus = pdPASS;
            printf("3333");
        }

        if( xStatus == pdPASS )
        {
            printf("4444");
            if( prvIsIPaddress( pxHostAddressData->pcHostAddress ) == ( uint32_t ) 0 )
            {
                xIsIPAddress = pdFALSE;
                printf("5555");
            }
            else
            {
                xIsIPAddress = pdTRUE;
                printf("6666");
            }

            xServerAddress.ucLength = sizeof( SocketsSockaddr_t );
            xServerAddress.usPort = SOCKETS_htons( pxHostAddressData->usPort );
            xServerAddress.ulAddress =
                SOCKETS_GetHostByName( pxHostAddressData->pcHostAddress );

            if( xServerAddress.ulAddress == 0u )
            {
                ggdconfigPRINT( "ERROR! Failed to resolve host address: ServerHost=%.*s",
                                xURLLength, pxHostAddressData->pcHostAddress );
            }

            xServerAddress.ucSocketDomain = SOCKETS_AF_INET;

            /* Set send timeout for the socket. */
            ( void ) SOCKETS_SetSockOpt( *pxSocket,
                                         0,
                                         SOCKETS_SO_SNDTIMEO,
                                         &xSendTimeOut,
                                         sizeof( xSendTimeOut ) );

            /* Set receive timeout for the socket. */
            ( void ) SOCKETS_SetSockOpt( *pxSocket,
                                         0,
                                         SOCKETS_SO_RCVTIMEO,
                                         &xReceiveTimeOut,
                                         sizeof( xReceiveTimeOut ) );

            /* Set secure connection. */
            ( void ) SOCKETS_SetSockOpt( *pxSocket,
                                         0,
                                         SOCKETS_SO_REQUIRE_TLS,
                                         NULL,
                                         ( size_t ) 0 );

            if( pxHostAddressData->pcCertificate != NULL )
            {
                /* Override TLS trust store with server certificate. */
                returnCode = SOCKETS_SetSockOpt( *pxSocket,
                                                 0,
                                                 SOCKETS_SO_TRUSTED_SERVER_CERTIFICATE,
                                                 pxHostAddressData->pcCertificate,
                                                 ( size_t ) pxHostAddressData->ulCertificateSize );

                if( returnCode != SOCKETS_ERROR_NONE )
                {
                    ggdconfigPRINT( "ERROR! Failure in SOCKET_SetSockOpt call for overriding TLS trust store: "
                                    "ReturnCode=%d\r\n", returnCode );
                    xStatus = pdFAIL;
                    printf("7777");
                }
            }

            if( xIsIPAddress == pdFALSE )
            {
                printf("8888");
                /* Enable use of SNI in TLS. */
                returnCode = SOCKETS_SetSockOpt( *pxSocket,
                                                 0,
                                                 SOCKETS_SO_SERVER_NAME_INDICATION,
                                                 pxHostAddressData->pcHostAddress,
                                                 ( size_t ) 1 + xURLLength );

                if( returnCode != SOCKETS_ERROR_NONE )
                {
                    ggdconfigPRINT( "ERROR! Failure in SOCKET_SetSockOpt call for enabling TLS SNI: "
                                    "ServerHost=%.*s, ReturnCode=%d\r\n",
                                    xURLLength, pxHostAddressData->pcHostAddress, returnCode );
                    xStatus = pdFAIL;
                    printf("9999");
                }
            }

            /* Establish the TCP connection. */
            if( pdPASS == xStatus )
            {
                printf("1010");
                returnCode = SOCKETS_Connect( *pxSocket,
                                              &xServerAddress,
                                              ( uint32_t ) sizeof( xServerAddress ) );

                 /***It always failed here***/
                if( returnCode != SOCKETS_ERROR_NONE )
                {
                    ggdconfigPRINT( "ERROR! SOCKETS_Connect call failed: ServerAddress=%lu, Port=%u, ReturnCode=%d\r\n",
                                    xServerAddress.ulAddress, xServerAddress.usPort, returnCode );
                    GGD_SecureConnect_Disconnect( pxSocket );
                    xStatus = pdFAIL;
                }
            }
        }
    }
    else
    {
        ggdconfigPRINT( "Malformed URL\r\n" );
        xStatus = pdFAIL;
    }

    return xStatus;
}`

Hmm, from the logs posted initial post, it looks like its getting past that and failing in GGD_GetIPandCertificateFromJSON after not finding the certificate key in prvGGDGetCertificate. Is that still the case? Would you be able to provide the JSON file retrieved by the application if so?

Yes. Sure.
Please find attachment.

Looking at that screenshot, the SOCKETS_Connect call is getting the correct ip/port from the json document, so the issue is likely with the Greengrass certificate. What is the error if the section with the /* Override TLS trust store with server certificate. */ comment is commented out? If that is done and the SOCKETS_Connect return code is one of the TLS ones then we can narrow the issue down to the certificate.

Are you still facing this issue?

authors: aggarg archigup jitendrazala

repo: aws/amazon-freertos


text:
test: Added context deploy benchmarking script

Description of Changes
Added implementation for context deploy benchmarking script. The script is called with the engine type being tested.
For example: ./context-benchmark.sh cromwell.
If no engine is provided when the script is called, it fails and asks the user to input an engine type.
For example:
context-deploy-benchmark % ./context-benchmark.sh
Please specify engine type to benchmark (cromwell | nextflow)

Within the script, there is a variable (CONTEXT_AMOUNT) defining how many contexts are going to be deployed, and will compute the average time across those contexts. The max value that CONTEXT_AMOUNT can be set to is 5. Once all contexts are deployed, average deployment time is returned in minutes and seconds.
Example execution:
ahmaalba@3c22fb77b124 context-deploy-benchmark % ./context-benchmark.sh cromwell
2021-10-21T10:15:58-07:00 𝒊  Deploying context(s)
Deploying resources for context 'cromwell1'... [-----------------------------------------------------------------------------------------------------------------------------------------------------------------]17m13s
DETAIL  ...
SUMMARY false   cromwell1
Average cromwell deployment time across 1 contexts is: 17 m 16 s

Description of how you validated changes
Tested locally and within EC2 t2.micro instances, with single and multime cromwell/nextflow contexts
Checklist

[x] If this change would make any existing documentation invalid, I have included those updates within this PR
[ ] I have added unit tests that prove my fix is effective or that my feature works
[x] I have linted my code before raising the PR
[x] Title of this Pull Request follows Conventional Commits standard: https://www.conventionalcommits.org/en/v1.0.0/

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Should the script also destroy the contexts afterwords?

source: gharchive/pull-request

repo: aws/amazon-genomics-cli

license_type: permissive

license_source: github-api


text:
Incompatibility with Hibernate 6.5

Describe the bug
Using Hibernate 6.5 and org.springframework.boot:spring-boot-starter-data-jpa writes fail.
Expected Behavior
Driver to work w/ Spring Boot 3.3 & Hibernate 6.5
What plugins are used? What other connection properties were set?
defaults for SF_D0 configuration profile
Current Behavior
Writes fail with this stack trace:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: java.lang.ClassCastException: class software.amazon.jdbc.wrapper.StatementWrapper cannot be cast to class java.sql.PreparedStatement (software.amazon.jdbc.wrapper.StatementWrapper is in unnamed module of loader 'app'; java.sql.PreparedStatement is in module java.sql of loader 'platform')] with root cause

java.lang.ClassCastException: class software.amazon.jdbc.wrapper.StatementWrapper cannot be cast to class java.sql.PreparedStatement (software.amazon.jdbc.wrapper.StatementWrapper is in unnamed module of loader 'app'; java.sql.PreparedStatement is in module java.sql of loader 'platform')
	at org.hibernate.generator.values.internal.GeneratedValuesHelper.readGeneratedValues(GeneratedValuesHelper.java:147)
	at org.hibernate.generator.values.internal.GeneratedValuesHelper.getGeneratedValues(GeneratedValuesHelper.java:103)
	at org.hibernate.id.insert.GetGeneratedKeysDelegate.performMutation(GetGeneratedKeysDelegate.java:121)
	at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorStandard.performNonBatchedOperations(MutationExecutorStandard.java:233)
	at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:55)
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.doStaticInserts(InsertCoordinatorStandard.java:194)
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.coordinateInsert(InsertCoordinatorStandard.java:132)
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.insert(InsertCoordinatorStandard.java:95)
	at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:85)
	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:670)
	at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:291)
	at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:272)
	at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:322)
	at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:391)
	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:305)
	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:224)
	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:137)
	at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:175)
	at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:93)
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:77)
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:54)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:757)
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:741)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:319)
	at jdk.proxy3/jdk.proxy3.$Proxy233.persist(Unknown Source)
	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:619)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:277)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
	at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516)
	at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:168)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:392)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:164)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.repository.core.support.MethodInvocationValidator.invoke(MethodInvocationValidator.java:95)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)

Reproduction Steps
A simple Spring Boot project using org.springframework.boot:spring-boot-starter-data-jpa and performing an insert via JpaRepository::save is sufficient.
I am able to reproduce in a simple repo integration test that's stood up with @DataJpaTest. Partial code:
@Import(AwsJdbcDriverConfiguration)
@DataJpaTest
@ActiveProfiles('local')
@AutoConfigureTestDatabase(replace = NONE)
class AuctionRepositorySpec extends Specification {

    @Autowired
    private AuctionRepository repo

    @Autowired
    private CompanyRepository companyRepo

    def "should find all auctions by company GUID"() {
        given:
        // stack trace is thrown on the next line by companyRepo.save
        CompanyEntity company = companyRepo.save(CompanyFixtures.companyEntity())
        AuctionEntity auction = repo.save(AuctionFixtures.auctionEntity(company : company))

        when:
        Page<AuctionEntity> auctionEntities = repo.findAllByCompanyGuid(auction.company.guid, Pageable.unpaged())

        then:
        auctionEntities.content == [auction]
    }

}

A full SSCCE would be difficult since it needs to create a table, the JPA entity, etc.
Possible Solution
No response
Additional Information/Context
Isolated this to the Hibernate version by running 4 different scenarios:

Spring Boot 3.3 & Hibernate 6.5.2.Final - fail
Spring Boot 3.3 & Hibernate 6.4.9.Final - pass
Spring Boot 3.2 & Hibernate 6.5.2.Final - fail
Spring Boot 3.2 & Hibernate 6.4.9.Final - pass

The AWS Advanced JDBC Driver version used
2.3.6 and 2.3.7
JDK version used
21
Operating System and version
Linux

Hi @efenderbosch-atg ,
Thanks for reaching out and raising this issue.
We'll take a look at this and keep you updated as we investigate.
Thank you for your patience!

+1 to this issue. Having the same issue after updating to Hibernate 6.5

+1 for this issue. It's blocking upgrading to Spring Boot 3.3

Hi @efenderbosch-atg, I am unable to reproduce the error at the moment. Would you be able to provide the following while we continue to investigate this issue?

Could you please enable and provide us the driver logs?
Could you please also provide an example of the datasource configuration?

I'm trying to get a minimally reproducing project together, but can't at this time because our dev instance only has the RDS Proxy endpoints exposed on our VPN. I can't directly connect to the main cluster endpoints from my machine. I've requested our DevOps allow that traffic. If/when that happens, I can hopefully provide a SSCCE where you just change the url/username/password and create the table.

Here is error with trace from our unit test
2024-07-29 16:28:12,526 TRACE PluginServiceImpl     - Set current host to HostSpec[host=localhost, port=57213, WRITER, AVAILABLE, weight=100, null]
2024-07-29 16:28:12,526 TRACE DriverConnectionProvider - Connecting with properties:
[tcpKeepAlive] false
[failureDetectionCount] 5
[monitoring-loginTimeout] 10000
[wrapperProfileName] SERVICE_RDS_DB
[useSSL] false
[database] service
[allowPublicKeyRetrieval] true
[monitoring-socketTimeout] 5000
[socketTimeout] 0
[connectTimeout] 10000
[failureDetectionInterval] 15000
[monitoring-connectTimeout] 10000
[loginTimeout] 10000
[zeroDateTimeBehavior] CONVERT_TO_NULL
[characterEncoding] UTF-8
[user] root
[failureDetectionTime] 60000
2024-07-29 16:28:12,526 TRACE DriverConnectionProvider - Connecting to jdbc:mysql://localhost:57213/service
with properties:
[allowPublicKeyRetrieval] true
[tcpKeepAlive] false
[socketTimeout] 0
[connectTimeout] 10000
[zeroDateTimeBehavior] CONVERT_TO_NULL
[characterEncoding] UTF-8
[user] root
[useSSL] false
2024-07-29 16:28:12,529 TRACE DialectManager        - Current dialect: mysql, software.amazon.jdbc.dialect.MysqlDialect, canUpdate: false
2024-07-29 16:28:12,530 TRACE OpenedConnectionTracker - [Internal Error] The driver is unable to track this opened connection because the instance endpoint is unknown.
2024-07-29 16:28:12,530 TRACE DefaultConnectionPlugin - Executing method: 'Connection.getAutoCommit'
2024-07-29 16:28:12,530 TRACE SessionStateServiceImpl - Current session state:
autoCommit: true -> (blank)
readOnly: (blank) -> (blank)
catalog: (blank) -> (blank)
schema: (blank) -> (blank)
holdability: (blank) -> (blank)
networkTimeout: (blank) -> (blank)
transactionIsolation: (blank) -> (blank)
typeMap: (blank) -> (blank)

2024-07-29 16:28:12,530 TRACE HostMonitoringConnectionPlugin - Executing method 'Connection.setAutoCommit', monitoring is activated.
2024-07-29 16:28:12,530 TRACE DefaultConnectionPlugin - Executing method: 'Connection.setAutoCommit'
2024-07-29 16:28:12,530 TRACE SessionStateServiceImpl - Current session state:
autoCommit: true -> false
readOnly: (blank) -> (blank)
catalog: (blank) -> (blank)
schema: (blank) -> (blank)
holdability: (blank) -> (blank)
networkTimeout: (blank) -> (blank)
transactionIsolation: (blank) -> (blank)
typeMap: (blank) -> (blank)

2024-07-29 16:28:12,531 TRACE HostMonitoringConnectionPlugin - Monitoring deactivated for method 'Connection.setAutoCommit'.
2024-07-29 16:28:12,550 TRACE DefaultConnectionPlugin - Executing method: 'Connection.prepareStatement'
2024-07-29 16:28:12,551 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.setInt'
2024-07-29 16:28:12,551 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.setString'
2024-07-29 16:28:12,551 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.setTimestamp'
2024-07-29 16:28:12,551 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.setString'
2024-07-29 16:28:12,551 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.setString'
2024-07-29 16:28:12,552 TRACE HostMonitoringConnectionPlugin - Executing method 'PreparedStatement.executeUpdate', monitoring is activated.
2024-07-29 16:28:12,552 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.executeUpdate'
2024-07-29 16:28:12,555 TRACE HostMonitoringConnectionPlugin - Monitoring deactivated for method 'PreparedStatement.executeUpdate'.
2024-07-29 16:28:12,555 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.getGeneratedKeys'
2024-07-29 16:28:12,556 TRACE DefaultConnectionPlugin - Executing method: 'ResultSet.getStatement'
2024-07-29 16:28:12,556 TRACE DefaultConnectionPlugin - Executing method: 'ResultSet.close'
2024-07-29 16:28:12,556 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.getMaxRows'
2024-07-29 16:28:12,556 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.getQueryTimeout'
2024-07-29 16:28:12,556 TRACE DefaultConnectionPlugin - Executing method: 'PreparedStatement.close'
2024-07-29 16:28:12,559 TRACE HostMonitoringConnectionPlugin - Executing method 'Connection.rollback', monitoring is activated.
2024-07-29 16:28:12,559 TRACE DefaultConnectionPlugin - Executing method: 'Connection.rollback'
2024-07-29 16:28:12,561 TRACE HostMonitoringConnectionPlugin - Monitoring deactivated for method 'Connection.rollback'.
2024-07-29 16:28:12,561 TRACE HostMonitoringConnectionPlugin - Executing method 'Connection.setAutoCommit', monitoring is activated.
2024-07-29 16:28:12,561 TRACE DefaultConnectionPlugin - Executing method: 'Connection.setAutoCommit'
2024-07-29 16:28:12,561 TRACE SessionStateServiceImpl - Current session state:
autoCommit: true -> true
readOnly: (blank) -> (blank)
catalog: (blank) -> (blank)
schema: (blank) -> (blank)
holdability: (blank) -> (blank)
networkTimeout: (blank) -> (blank)
transactionIsolation: (blank) -> (blank)
typeMap: (blank) -> (blank)

2024-07-29 16:28:12,562 TRACE HostMonitoringConnectionPlugin - Monitoring deactivated for method 'Connection.setAutoCommit'.
2024-07-29 16:28:12,562 TRACE DefaultConnectionPlugin - Executing method: 'Connection.isClosed'
2024-07-29 16:28:12,562 TRACE DefaultConnectionPlugin - Executing method: 'Connection.clearWarnings'
2024-07-29 16:28:12,562 TRACE DefaultConnectionPlugin - Executing method: 'Connection.close'
2024-07-29 16:28:12,562 TRACE SessionStateServiceImpl - Current session state:
autoCommit: true -> true
readOnly: (blank) -> (blank)
catalog: (blank) -> (blank)
schema: (blank) -> (blank)
holdability: (blank) -> (blank)
networkTimeout: (blank) -> (blank)
transactionIsolation: (blank) -> (blank)
typeMap: (blank) -> (blank)

2024-07-29 16:28:12,562 DEBUG ConnectionPluginManager - Releasing resources.
2024-07-29 16:28:12,562 DEBUG PluginServiceImpl     - Releasing resources.
2024-07-29 16:28:12,573 DEBUG ConnectionPluginManager - Releasing resources.
2024-07-29 16:28:12,573 DEBUG PluginServiceImpl     - Releasing resources.
2024-07-29 16:28:12,573 DEBUG ConnectionPluginManager - Releasing resources.
2024-07-29 16:28:12,573 DEBUG PluginServiceImpl     - Releasing resources.
2024-07-29 16:28:12,573 DEBUG ConnectionPluginManager - Releasing resources.
2024-07-29 16:28:12,573 DEBUG PluginServiceImpl     - Releasing resources.

class software.amazon.jdbc.wrapper.StatementWrapper cannot be cast to class java.sql.PreparedStatement (software.amazon.jdbc.wrapper.StatementWrapper is in unnamed module of loader 'app'; java.sql.PreparedStatement is in module java.sql of loader 'platform')
java.lang.ClassCastException: class software.amazon.jdbc.wrapper.StatementWrapper cannot be cast to class java.sql.PreparedStatement (software.amazon.jdbc.wrapper.StatementWrapper is in unnamed module of loader 'app'; java.sql.PreparedStatement is in module java.sql of loader 'platform')
	at org.hibernate.generator.values.internal.GeneratedValuesHelper.readGeneratedValues(GeneratedValuesHelper.java:147)
	at org.hibernate.generator.values.internal.GeneratedValuesHelper.getGeneratedValues(GeneratedValuesHelper.java:103)
	at org.hibernate.id.insert.GetGeneratedKeysDelegate.performMutation(GetGeneratedKeysDelegate.java:121)
	at org.hibernate.engine.jdbc.mutation.internal.MutationExecutorSingleNonBatched.performNonBatchedOperations(MutationExecutorSingleNonBatched.java:47)
	at org.hibernate.engine.jdbc.mutation.internal.AbstractMutationExecutor.execute(AbstractMutationExecutor.java:55)
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.doDynamicInserts(InsertCoordinatorStandard.java:317)
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.coordinateInsert(InsertCoordinatorStandard.java:129)
	at org.hibernate.persister.entity.mutation.InsertCoordinatorStandard.insert(InsertCoordinatorStandard.java:95)
	at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:85)
	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:670)
	at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:291)
	at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:272)
	at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:322)
	at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:391)
	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:305)
	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:224)
	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:137)
	at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:175)
	at org.hibernate.event.internal.DefaultPersistEventListener.persist(DefaultPersistEventListener.java:93)
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:77)
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:54)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:127)
	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:757)
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:741)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:319)
	at jdk.proxy3/jdk.proxy3.$Proxy271.persist(Unknown Source)
	at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:629)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:354)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker$RepositoryFragmentMethodInvoker.lambda$new$0(RepositoryMethodInvoker.java:277)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
	at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
	at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:516)
	at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:285)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:628)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:168)
	at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:143)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:70)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:379)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:165)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
	at jdk.proxy3/jdk.proxy3.$Proxy276.save(Unknown Source)
	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:733)
	at org.mockito.internal.util.reflection.InstrumentationMemberAccessor$Dispatcher$ByteBuddy$X2L5k5m9.invokeWithArguments(Unknown Source)
	at org.mockito.internal.util.reflection.InstrumentationMemberAccessor.invoke(InstrumentationMemberAccessor.java:251)
	at org.mockito.internal.util.reflection.ModuleMemberAccessor.invoke(ModuleMemberAccessor.java:55)
	at org.mockito.internal.stubbing.defaultanswers.ForwardsInvocations.answer(ForwardsInvocations.java:48)
	at org.mockito.internal.handler.MockHandlerImpl.handle(MockHandlerImpl.java:111)
	at org.mockito.internal.handler.NullResultGuardian.handle(NullResultGuardian.java:29)
	at org.mockito.internal.handler.InvocationNotifierHandler.handle(InvocationNotifierHandler.java:34)
	at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:82)
	at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor.doIntercept(MockMethodInterceptor.java:56)
	at org.mockito.internal.creation.bytebuddy.MockMethodInterceptor$DispatcherDefaultingToRealMethod.interceptAbstract(MockMethodInterceptor.java:161)
.....
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:728)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:218)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:214)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:139)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:119)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:94)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:89)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy2/jdk.proxy2.$Proxy5.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

@karenc-bq actual exception is thrown here

The resultSet there is a software.amazon.jdbc.wrapper.ResultSetWrapper which on getStatement returns software.amazon.jdbc.wrapper.StatementWrapper which wraps com.mysql.cj.jdbc.ClientPreparedStatement but itself doesn't implements  java.sql.PreparedStatement

Hi @yurybubnov, does your application have any Hibernate dialect specified?

@karenc-bq we don't specify dialect directly but I believe it's derived from JDBC URL

is it possible to release version with the fix?

Hi @yurybubnov, @efenderbosch-atg , could you please verify if the latest changes address the issue for you? You can find the latest change in the snapshot build aws-advanced-jdbc-wrapper-2.3.8-20240801.015042-24.jar. More information on how to use the snapshot build is available here.
We understand this is a blocking issue for you, we will schedule another release if this latest change resolves the issue.

@karenc-bq works for me

Thank you for verifying the fix. We will schedule a release for next week.

This is out in 2.3.9, right? I upgraded to Spring Boot 3.3 and advanced driver 2.3.9 and it appears to be working. What's your workflow? Do you want me to close this as resolved, or leave for a team member?
Thanks for the fix!

Hi @efenderbosch-atg, it appears we forgot to follow up here, my apologies. The fix is indeed in version 2.3.9. I will be closing this ticket, but feel free to reopen it or create a new ticket if you need further assistance. Thanks!

source: gharchive/issue

authors: aaron-congo aaronchung-bitquill efenderbosch-atg elveskevtar karenc-bq yurybubnov

repo: aws/aws-advanced-jdbc-wrapper


text:
[Elasticache] ReplicationGroup endpoint not visible

Describe the bug
After creating ReplicationGroup I was not able to see the ConfigurationEndpoint Address and port information.
kubectl describe replicationgroup/test-rg
Name:         test-rg
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"elasticache.services.k8s.aws/v1alpha1","kind":"ReplicationGroup","metadata":{"annotations":{},"name":"test-rg","namespace":...
API Version:  elasticache.services.k8s.aws/v1alpha1
Kind:         ReplicationGroup
Metadata:
  Creation Timestamp:  2020-08-20T23:37:25Z
  Finalizers:
    finalizers.elasticache.services.k8s.aws/ReplicationGroup
  Generation:        1
  Resource Version:  5263393
  Self Link:         /apis/elasticache.services.k8s.aws/v1alpha1/namespaces/default/replicationgroups/test-rg
  UID:               UUID
Spec:
  Automatic Failover:             true
  Cache Node Type:                cache.t3.medium
  Engine:                         redis
  Num Node Groups:                3
  Replicas Per Node Group:        2
  Replication Group Description:  test
  Replication Group ID:           test-rg
Events:                           <none>

Steps to reproduce
apiVersion: elasticache.services.k8s.aws/v1alpha1
kind: ReplicationGroup
metadata:
  name: test-rg
spec:
    engine: redis
    replicationGroupID: test-rg
    replicationGroupDescription: test
    automaticFailover: true
    cacheNodeType: cache.t3.medium
    numNodeGroups: 3
    replicasPerNodeGroup: 2

Expected outcome
Get Elasticache endpoint and port information
Environment

Kubernetes version 1.17
Using EKS (yes/no), if so version?  EKS 1.17
AWS service targeted Elasticache

This has been fixed


text:
Elasticache Replication Group initial coverage/negative tests

Description of changes:
Addition of 9 initial coverage/negative tests covering creation and modification of Replication Groups. Updated existing and added new test utility functions in elasticache.sh
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Related issue #454


text:
PubSub example fails with logging enabled.

Hi, I've tried to enable logging for the PubSub example.
I replaced the following code in the runtimeHub.py init function
from;

    self._logManagerHub.disable()

to;

     self._logManagerHub.enable()
     self._logManagerHub.enableFileOutput()

The previously running example now fails consistently with a -1 error.

    AWS IoT SDK Version(dev) 1.0.3-

    Setup failed!
    -1

The logger does create a new log;

[2016-03-04 14:10:41.256372] Register timeout signal handler.
[2016-03-04 14:10:41.272485] serialCommunicationServer init.
[2016-03-04 14:10:41.277257] serialCommunicationServer set accept timeout to 15
[2016-03-04 14:10:41.282366] serialCommunicationServer set chunk size to 50
[2016-03-04 14:10:41.287254] Clear internal list. Size: 0
[2016-03-04 14:10:41.291974] Accept-timer starts, with acceptTimeout: 15 second(s).
[2016-03-04 14:10:41.296875] 4 lines to be received. Loop begins.
[2016-03-04 14:10:41.301735] Received: 1/4 Message is: i
[2016-03-04 14:10:41.306648] Received: 2/4 Message is: cvmon1
[2016-03-04 14:10:41.311479] Received: 3/4 Message is: 1
[2016-03-04 14:10:41.316364] Received: 4/4 Message is: 4
[2016-03-04 14:10:41.321048] Finish reading from remote client. Accept-timer ends.
[2016-03-04 14:10:41.330683] Paho MQTT Client init.
[2016-03-04 14:10:41.337009] Register Paho MQTT Client callbacks.
[2016-03-04 14:10:41.341630] mqttCore init.
[2016-03-04 14:10:41.346389] Set maximum connect/disconnect timeout to be 10 second.
[2016-03-04 14:10:41.351113] Set maximum MQTT operation timeout to be 5 second
[2016-03-04 14:10:41.356251] Updated serialCommunicationServer internal protocolMessageQueue by inserting a new message. Size: 1
[2016-03-04 14:10:41.361421] Send through serial to remote client: I T Size: 3
[2016-03-04 14:10:41.366106] Clear internal list. Size: 0
[2016-03-04 14:10:41.370721] Accept-timer starts, with acceptTimeout: 15 second(s).
[2016-03-04 14:10:56.370924] Raise a custom exception for accept timeout.
[2016-03-04 14:10:56.373646] Accept Timeout

Have I missed something in enabling logging?
Thanks,
Jeff

Hi Jeff,
Thank you very much for using AWS IoT Arduino Yun SDK!
The AWS IoT Arduino Yun SDK is built on top of the dual processor architecture. ATmega32u4 accepts user commands and communicates them back to AR9331 through Serial1 bridge. The AR9331 then does all the heavy-lifting MQTT operations. A Serial1 communication protocol is established to make the transmission happen between the two processors, just as what you see in the log file.
This protocol occupies the STD_IN/STD_OUT on AR9331. In other words, the STD_IN/STD_OUT for AR9331 should not have other messages going through, otherwise it will break the protocol and trigger the error handling in SDK. The enable method for logging automatically enables the console output as default, which breaks the protocol. You will need to specifically disable it:
 self._logManagerHub.enable()
 self._logManagerHub.enableFileOutput()
 self._logManagerHub.disableConsolePrint()

In this case, you should be able to do persistent logging and store them as log files on AR9331, without breaking the Serial1 protocol in between.
However, one important thing to keep in mind is that doing persistent logging directly on AR9331 is not a very good idea, as is mentioned in the official Arduino Yun Getting Started Guide:

You're discouraged from using the Yún's built-in non-volatile memory, because it has a limited number of writes.

If you really want persistent logging, one thing you can do is to use external memory like a microSD card or thumb drive and expand the disk space for Arduino Yun. More details can be found on Arduino Tutorials.
Hope that answers your question. Please feel free to reopen the issue if you have more questions.
Thanks,
Liusu

Hi Liusu,
Thanks for the reply. I was aware of the Serial1 bridge but did not catch explicitly disabling the console. I have added a microSD card though I am only enabling the logging to extend the SDK to add some functionality lost by the unavailability of the Serial1 bridge. Specifically I would like to add a call to the python time() function in the runtime and return it to the mcu.
Is there any documentation available regarding extending the SDK?
Thanks,
Jeff

On Mar 4, 2016, at 8:30 PM, Liusu Zeng notifications@github.com wrote:
Hi Jeff,
Thank you very much for using AWS IoT Arduino Yun SDK!
The AWS IoT Arduino Yun SDK is built on top of the dual processor architecture. ATmega32u4 accepts user commands and communicates them back to AR9331 through Serial1 bridge. The AR9331 then does all the heavy-lifting MQTT operations. A Serial1 communication protocol is established to make the transmission happen between the two processors, just as what you see in the log file.
This protocol occupies the STD_IN/STD_OUT on AR9331. In other words, the STD_IN/STD_OUT for AR9331 should not have other messages going through, otherwise it will break the protocol and trigger the error handling in SDK. The enable method for logging automatically enables the console output as default, which breaks the protocol. You will need to specifically disable it:
self._logManagerHub.enable()
self._logManagerHub.enableFileOutput()
self._logManagerHub.disableConsolePrint()
In this case, you should be able to do persistent logging and store them as log files on AR9331, without breaking the Serial1 protocol in between.
However, one important thing to keep in mind is that doing persistent logging directly on AR9331 is not a very good idea, as is mentioned in the official Arduino Yun Getting Started Guide https://www.arduino.cc/en/Guide/ArduinoYun#toc4:
You're discouraged from using the Yún's built-in non-volatile memory, because it has a limited number of writes.
If you really want persistent logging, one thing you can do is to use external memory like a microSD card or thumb drive and expand the disk space for Arduino Yun. More details can be found on Arduino Tutorials https://www.arduino.cc/en/Tutorial/ExpandingYunDiskSpace.
Hope that answers your question. Please feel free to reopen the issue if you have more questions.
Thanks,
Liusu
—
Reply to this email directly or view it on GitHub https://github.com/aws/aws-iot-device-sdk-arduino-yun/issues/9#issuecomment-192429564.

Hi Jeff,
Currently we do not have a detailed documentation to extend the SDK.
For a custom command over the Serial1 bridge, the part of the SDK you need to extend is the Python runtime library.
The core functionality for AWS IoT Arduino Yun lies in the Python runtime library, which provides an interface for Serial1 communication: serialCommunicationServer. The AWS-IoT-Arduino-Yun-Library (the one gets included in Arduino IDE and runs on ATmega) generates the protocol-style command pieces and sends it over the Serial1 bridge. The serialCommunicationServer accepts commands (in protocol style) from ATmega and then triggers the corresponding command on the Python side.
-----------------------ATmega----------------------|-Serial1-|---------------------AR9331---------------------
ArduinoLib API call -> protocol-style command ->>>> serialCommunicationServer -> PyCmd -> AWS IoT
------------------------------------------------------|-----------|--------------------------------------------------
Each of the Serial1 command has its own protocol representation. You can get a better overview of the built-in commands by checking here.
Take aws_iot_mqtt_client::config as an example. If you look into the implementation of AWS-IoT-Arduino-Yun-Library, you can find that what config API actually does is to print protocol-style command pieces to Serial1:
exec_cmd("6\n", false, false);
exec_cmd("g\n", false, false);
    ...
exec_cmd(rw_buf, false, false);
exec_cmd(rw_buf, false, false);
    ...
exec_cmd(rw_buf, false, false);
    ...
exec_cmd(rw_buf, false, false);
    ...
exec_cmd(rw_buf, true, false);

So the protocol-style command pieces for config would like this:
6\ng\n<param0>\n<param1>\n<param2>\n<param3>\n<param4>\n

with a newline at the end of each chunk.
Then on the Python side (serialCommunicationServer), it accepts these protocol command pieces line by line and recognizes them to be the config command. It triggers the execution of the corresponding commandClass: commandConfig, performs the operation and writes back the response:
...
self._mqttCoreHandler.config(self._parameterList[0], int(self._parameterList[1]), self._parameterList[2], self._parameterList[3], self._parameterList[4])
...
self._serialCommServerHandler.writeToInternalProtocol(returnMessage)

Basically, a custom command will do the same thing by utilizing the Linux processor and communicate back the resources to ATmega. Adding a new custom command requires a new Python command class, a new protocol command and the corresponding API for AWS-IoT-Arduino-Yun-Library. The serialCommunicationServer also needs to be modified to allow new commands to be accepted and executed.
We are sorry we cannot provide a more positive answer about extending the SDK at this moment. Please feel free to post follow-up questions as you dive deeper into this.
Thanks,
Liusu

authors: liuszeng vaneek

repo: aws/aws-iot-device-sdk-arduino-yun

license_source: bigquery


text:
WebSocket Response header: Incorrect connection header

Hi,
i am following the tutorial https://github.com/aws/aws-iot-device-sdk-java/blob/master/README.md to connect from Java to IoT through MQTT over WebSocket. I am using the simple main:
	AWSIotMqttClient client = new AWSIotMqttClient(clientEndpoint, clientId, awsAccessKeyId, awsSecretAccessKey);
		client.connect();

But i get error:
WARNING: Connect request failure
MqttException (0) - java.io.IOException: WebSocket Response header: Incorrect connection header
....
I am using my AWS credential. My user is also admin and i have policy for full access to IoT:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "iot:",
"Resource": ""
}
]
}
can you pls help?
thanks lot.

#23 Might be the issue

thnaks lot yaswanth89
Downgrading to following worked!
<dependency>
    <groupId>org.eclipse.paho</groupId>
    <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
    <version>1.1.0</version>

thnaks lot yaswanth89
Downgrading to following worked!
<dependency>
    <groupId>org.eclipse.paho</groupId>
    <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
    <version>1.1.0</version>

Which place we should add this in project?

authors: JigneshPiZone smoms yaswanth89

repo: aws/aws-iot-device-sdk-java


text:
Missing T4 InstanceType

AWSSDK.EC2 3.5.5 - missing constant T4 instances in InstanceType class.

Hi @rczwojdrak,
Please try upgrading to version 3.5.6 and let me know if you still see the issue.
Thanks,
Ashish

authors: ashishdhingra rczwojdrak

repo: aws/aws-sdk-net


text:
Slow Publish calls on IAmazonSimpleNotificationServiceClient

Environment

SDK Version: 3.3.102.11
.Net Platform: netcoreapp3.1
OS: Azure Windows App Service (North Europe)
Amazon Data Center: Ireland

We do run an Aspnet Core API in a Azure App Plan, today we noticed some delays when publishing a notification.
We use application insights to track our dependencies
dependencies | where cloud_RoleName contains "****" and timestamp > ago(2h) and target == "sns.eu-west-1.amazonaws.com" | summarize count=count() by performanceBucket
All these dependency call's are "Posts" to publish a notification, but the results are quite surprising.

In total we did an Total of 3610 call's over a period of 10 minutes - but we see that 14% of the call's to SNS takes longer than 1 second - and event with outliers going to 15 seconds!
We don't think we are hitting the SNS throttle limits  https://docs.aws.amazon.com/general/latest/gr/sns.html as it states that it can handle publishes requests till 30/second - and we are still far from it.
Important: this test run was publishing to the same Topic - we'll re-run this load across multiple topics.
❓ Did anybody else experiences these response times? Is there a throttle limit per Topic?
Thanks
Jonathan

Hi @msjonathan,
Good morning.
Thanks for posting the guidance question. Could you please share code snippet which uses AWS .NET SDK and uses  IAmazonSimpleNotificationServiceClient to publish SNS messages? Also advise if you tried running the same logic in AWS environment and it still has noticeable delay.
While I do not have any metrics for response times, most likely there could be delays at SNS service side.
Thansk,
Ashish

Hej @ashishdhingra ,
It's a very basic setup.
In the startup.cs
`var awsOptions = Configuration.GetAWSOptions();
var awsAccessKey = Configuration.GetValue("AWS:Credentials:AccessKey");
var awsSecretKey = Configuration.GetValue("AWS:Credentials:SecretKey");
        awsOptions.Credentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
        services.AddDefaultAWSOptions(awsOptions);

        services.AddAWSService<IAmazonSimpleNotificationService>();`

In a Service Class we inject the "IAmazonSimpleNotificationService " in the ctor and assign it to a member of that class.
var response = await _snsClient.PublishAsync(request);
Currently we are using 98% of Azure infrastructure, therefor we would like to keep the client on Azure infrastucture.
Thanks.
Jonathan

Hej @ashishdhingra ,
It's a very basic setup.
In the startup.cs
var awsOptions = Configuration.GetAWSOptions();
            var awsAccessKey = Configuration.GetValue<string>("AWS:Credentials:AccessKey");
            var awsSecretKey = Configuration.GetValue<string>("AWS:Credentials:SecretKey");
             awsOptions.Credentials = new BasicAWSCredentials(awsAccessKey, awsSecretKey);
            services.AddDefaultAWSOptions(awsOptions);

            services.AddAWSService<IAmazonSimpleNotificationService>();

In a Service Class we inject the "IAmazonSimpleNotificationService " in the ctor and assign it to a member of that class.
var response = await _snsClient.PublishAsync(request);
Currently we are using 98% of Azure infrastructure, therefor we would like to keep the client on Azure infrastucture.
Thanks.
Jonathan

Hi @msjonathan,
I do see that it's a very basic example to use SNS service to publish messages. I'm not sure if there is any latency caused within the Azure infrastructure which could be causing that delay. That's why I was curious if you see the same latency when running the application outside of Azure infrastructure, may be in private server. You might want to also try running some kind of network trace (not sure how it would be done in Azure environment) to figure out the delay and implement optimizations accordingly.
Thanks,
Ashish

authors: ashishdhingra msjonathan


text:
AmazonSQSClient.SendMessageAsync throws TaskCanceledException after messaged was published

Description
AmazonSQSClient.SendMessageAsync throws TaskCanceledException even though the message was published.
Reproduction Steps
Reliable reproduction is not possible at this time. We only observed this issue during a load test. We noticed it on more than 1 occassion during the load test though.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
    at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
    at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
    at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
    at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
    at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
    at UW.Data.Platform.Inbound.Messaging.JobPublisher.Publish(Job job, CancellationToken cancellationToken, IWorkScope work) in /src/core/Inbound.Lib/Messaging/JobPublisher.cs:line 150
    at UW.Data.Platform.Inbound.API.Services.Processors.BaseProcessor`1.Process(ProcessRequest`1 pr, CancellationToken cancellationToken) in /src/api/API/Services/Processors/BaseProcessor.cs:line 74
    at UW.Data.Platform.Inbound.API.Services.Processors.BaseProcessor`1.Process(ProcessRequest`1 pr, CancellationToken cancellationToken) in /src/api/API/Services/Processors/BaseProcessor.cs:line 74
    at UW.Data.Platform.Inbound.API.AccountingJournalEndpoints.PostAccountingJournal.HandleAsync(PostAccountingJournalRequest request, CancellationToken cancellationToken) in /src/api/API/AccountingJournalEndpoints/PostAccountingJournal.cs:line 75
    at lambda_method35(Closure , Object )
    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Happy to provide message details in private if necessary.
Logs
We have no logs with more information than the stack trace above.
Environment

SDK Version: AWSSDK.Core v3.7.7
Package Version: AWSSDK.SQS v3.7.2.20
OS Info: Debian 11 via mcr.microsoft.com/dotnet/aspnet:6.0-bullseye-slim
Build Environment ubuntu:18.04
Targeted .NET Platform:  net6

Resolution

[ ] :wave: I can/would-like-to implement a fix for this problem myself

Seems to me if a message was successfully published, than any subsequent calls should not propagate exceptions to the caller. Collect metrics if you can, but don't blow up the call stack if you can't.

This is a :bug: bug-report

Hi @cspital,
Good afternoon.
Please share the application details and sample code to troubleshoot the issue. Also, are you running the code in Docker (per OS Info above).
Thanks,
Ashish

Hi, of course and thank you.
This is an ASP.NET Core application, it is serving a REST API for handling writes to the enterprise's underlying source of truth. We save the materials to s3 and send a message to a worker to march the submission through it's paces in the underlying system. What happened was the API fired a message but rolledback at the database and so the workers have been erroring on those (there were 8 instances of this happening during our load test).
We are running this application in AWS ECS Fargate instances.
I'm happy to share more details if this isn't enough, like I said this is the first time we've noticed this and it only happened at our peak tested load.
Controller Handler
public override async Task<ActionResult<PostAccountingJournalResponse>> HandleAsync([FromBody] PostAccountingJournalRequest request, CancellationToken cancellationToken = default)
{
    var authorized = Authorize(request);
    if (!authorized)
    {
        return StatusCode(403, new ForbiddenResult(authorized));
    }

    var validated = AccountingJournalFactory.From(new WebAccountingJournalCandidateProvider(request));
    if (!validated)
    {
        foreach (var err in validated.Errors)
        {
            ModelState.AddModelError(err.Field, err.ToString());
            return ValidationProblem(ModelState);
        }
    }

    var pr = GetProcessRequest(request, validated.Item);

    var context = await _processor.Process(pr, cancellationToken); // thrown from here

    return Created(Url.Link("GetContext", new { uuid = context.Uuid.ToString() })!, new PostAccountingJournalResponse
    {
        Context = GetContextResponse.From(context)
    });
}

Processor
public async Task<Context> Process(ProcessRequest<T> pr, CancellationToken cancellationToken = default)
{
    var publisher = _publisherFactory.GetPublisher(Resource);
    await _work.BeginTransaction(cancellationToken);

    try
    {
        var context = await CreateContext(pr.Payload, _work, cancellationToken);
        await EnrichContext(pr, context, cancellationToken);
        await publisher.Publish(GetJob(context), cancellationToken, _work); // thrown from here
        await _work.Commit(cancellationToken); // we've changed this to CancellationToken.None already
        return context;
    }
    catch
    {
        await Cleanup(); // rollback
        throw;
    }
}

Publisher
public async Task Publish(Job job, CancellationToken cancellationToken = default, IWorkScope? work = null)
{
    try
    {
        _logger.LogInformation("Publishing {@job}", new { job.ContextId, job.ContextUuid, job.State, job.ContentLength, job.Resource, job.PlatformVersion });

        var payload = new JobPayload
        {
            ContextId = job.ContextId,
            ContextUuid = job.ContextUuid.ToString(),
            State = job.State.ToString(),
            ContentLength = job.ContentLength,
            Resource = job.Resource,
            PlatformVersion = job.PlatformVersion
        };

        await _queue.SendMessage<JobPayload>(payload, new SendParams
        {
            QueueUrl = _subbing.QueueUrl,
            Delay = TimeSpan.FromSeconds(0)
        }, cancellationToken); // thrown from here

        await _tracer.Write(new ContextEvent
        {
            ContextId = job.ContextId,
            EventType = EventType.Pushed,
            Success = true,
            ContainerId = _hosting.ContainerId,
            Detail = ContextEvent.GetDetailObject("PushedJobData", new
            {
                Sent = DateTime.UtcNow,
                Receives = job.Metadata.Receives,
                Received = job.Metadata.Received,
                Expires = job.Metadata.Expires
            })
        }, cancellationToken, work);
    }
    catch (Exception e) when (e.IsNotCancelled())
    {
        _logger.LogError(e, "Error publishing {@job}", new { job.ContextId, job.State });
        await _tracer.Write(new ContextEvent
        {
            ContextId = job.ContextId,
            EventType = EventType.Pushed,
            Success = false,
            ContainerId = _hosting.ContainerId,
            Detail = ContextEvent.GetDetailObject("PushedJobData", new
            {
                Sent = DateTime.UtcNow,
                Receives = job.Metadata.Receives,
                Received = job.Metadata.Received,
                Expires = job.Metadata.Expires
            })
        }, cancellationToken, work);
        throw;
    }
}

Queue
public class SqsQueue : IQueueTTLReader, IQueueTTLWriter, IQueueWriter, IQueueReader, IMessageLifetimeWriter
{
    static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

    readonly IAmazonSQS _sqs;
    readonly JsonSerializerSettings _settings;

    public SqsQueue(
        IAmazonSQS amazonSQS)
    {
        _sqs = amazonSQS ?? throw new ArgumentNullException(nameof(amazonSQS));
        _settings = JsonSettings.Default;
    }

    // ...elided...

    public Task SendMessage<T>(T obj, SendParams @params, CancellationToken cancellationToken = default)
        where T : class
    {
        var body = JsonConvert.SerializeObject(obj, _settings);

        return _sqs.SendMessageAsync(new SendMessageRequest
        {
            QueueUrl = @params.QueueUrl,
            DelaySeconds = (int)@params.Delay.TotalSeconds,
            MessageBody = body
        }, cancellationToken);
    }
}

Was there any determination as to what this issue was? We are getting these randomly as well and our setup seems to be the same: ASP.Net 6, AWSSDK.Core: 3.7.5.3, AWSSDK.S3 3.3.110.28
{"message":"ProcessMessage failed: messageId=6e4a14d5-fb4c-453e-ad41-1b28fcb6618e error=\u0027A task was canceled.\u0027","level":"fail","logName":"OURCOMPANY.Distributed.Aws.SqsWorker.SqsWorkerService","eventId":0,"utcDateTime":"2022-09-07T20:37:13.6483638Z","exception":"System.Threading.Tasks.TaskCanceledException: A task was canceled.\n   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)\n   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n   at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task\u00601 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\n   at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)\n   at Amazon.Runtime.Internal.HttpHandler\u00601.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.Unmarshaller.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.SQS.Internal.ValidationResponseHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.ErrorHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.EndpointDiscoveryHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)\n   at OURCOMPANY.Distributed.Aws.SqsWorker.QueueConsumer.DeleteMessageAsync(QueueMessage message, CancellationToken cancellationToken)\n   at OURCOMPANY.Distributed.Aws.SqsWorker.SqsWorkerServiceBase.ProcessMessage(QueueMessage message, CancellationToken stoppingToken)"}

authors: BTBP ashishdhingra cspital