stm32f7 https connection using with mbedtls - c

my connnection is return -0x0050 on ssl_tls step.
< Read from server:../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:8270: => read<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:4311: => read record<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:2536: => fetch input<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:2696: in_left: 0, nb_want: 5<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:2720: in_left: 0, nb_want: 5<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:2722: ssl->f_recv(_timeout)() returned -80 (-0x0050)<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:4973: mbedtls_ssl_fetch_input() returned -80 (-0x0050)<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:4344: ssl_get_next_record() returned -80 (-0x0050)<\n>
../Middlewares/Third_Party/mbedTLS/library/ssl_tls.c:8335: mbedtls_ssl_read_record() returned -80 (-0x0050)<\n>
I tried to connect google.
I tried change heap size. I tried connect to other website etc.

Related

Vulkan swapchain creation causes crash with no debug information

I'm following vulkan-tutorial's procedure to understand vulkan, I'm now in creating swapchain. before that I've also created instance and a debug/validation layer but when I'm trying to create swapchain, the app crashes.
void createSwapChain() {
VkSurfaceFormatKHR surfaceFormat;
surfaceFormat.format=VK_FORMAT_B8G8R8A8_SRGB;
surfaceFormat.colorSpace=VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
VkPresentModeKHR presentMode=VK_PRESENT_MODE_FIFO_KHR;
int width,height;
glfwGetFramebufferSize(window, &width, &height);
VkExtent2D extent ={width,height};
uint32_t imageCount=2;//minimum cap +1
VkSurfaceCapabilitiesKHR capabilities;
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, &capabilities);
VkSwapchainCreateInfoKHR createInfo={0};
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
createInfo.surface = surface;
createInfo.minImageCount = imageCount;
createInfo.imageFormat = surfaceFormat.format;
createInfo.imageColorSpace = surfaceFormat.colorSpace;
createInfo.imageExtent = extent;
createInfo.imageArrayLayers = 1;
createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
// createInfo.queueFamilyIndexCount = 1;
// createInfo.pQueueFamilyIndices = NULL;
createInfo.preTransform = capabilities.currentTransform/*VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR*/;//swapChainSupport.capabilities.currentTransform
createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
createInfo.presentMode = presentMode;
createInfo.clipped = VK_TRUE;// means obscured images have unimportant color!!
createInfo.oldSwapchain = VK_NULL_HANDLE;
if (vkCreateSwapchainKHR(device, &createInfo, NULL, &swapChain) != VK_SUCCESS)
printf("failed to create swap chain!");
}
Is there any idea? The host is eclipse with MinGW-64 -lglfw3 and -lvulkan-1 on windows 10 64-bit.
And here the graphic card information:
Available Layers:
VK_LAYER_AMD_switchable_graphics
VK_LAYER_VALVE_steam_overlay
VK_LAYER_VALVE_steam_fossilize
VK_LAYER_KHRONOS_validation
Available extensions:
VK_KHR_device_group_creation
VK_KHR_external_fence_capabilities
VK_KHR_external_memory_capabilities
VK_KHR_external_semaphore_capabilities
VK_KHR_get_physical_device_properties2
VK_KHR_get_surface_capabilities2
VK_KHR_surface
VK_KHR_win32_surface
VK_EXT_debug_report
VK_EXT_debug_utils
VK_EXT_swapchain_colorspace
Instance extension:
VK_KHR_surface
VK_KHR_win32_surface
VK_EXT_debug_utils
Availible devices:
AMD Radeon(TM) Graphics Type: 1 GeometryShader: Yes
FamilyIndex: 0 AvailibleQueueCount: 1 Surface Support: Yes Graphics | Compute | Transfer | Binding
FamilyIndex: 1 AvailibleQueueCount: 2 Surface Support: Yes | Compute | Transfer | Binding
FamilyIndex: 2 AvailibleQueueCount: 1 Surface Support: Yes | | Transfer | Binding
Availible device extensions: (The required is VK_KHR_swapchain)
VK_KHR_16bit_storage VK_KHR_8bit_storage VK_KHR_bind_memory2
VK_KHR_buffer_device_address VK_KHR_copy_commands2 VK_KHR_create_renderpass2
VK_KHR_dedicated_allocation VK_KHR_depth_stencil_resolve VK_KHR_descriptor_update_template
VK_KHR_device_group VK_KHR_draw_indirect_count VK_KHR_driver_properties
VK_KHR_dynamic_rendering VK_KHR_external_fence VK_KHR_external_fence_win32
VK_KHR_external_memory VK_KHR_external_memory_win32 VK_KHR_external_semaphore
VK_KHR_external_semaphore_win32 VK_KHR_format_feature_flags2 VK_KHR_get_memory_requirements2
VK_KHR_global_priority VK_KHR_imageless_framebuffer VK_KHR_image_format_list
VK_KHR_maintenance1 VK_KHR_maintenance2 VK_KHR_maintenance3
VK_KHR_maintenance4 VK_KHR_multiview VK_KHR_pipeline_executable_properties
VK_KHR_pipeline_library VK_KHR_push_descriptor VK_KHR_relaxed_block_layout
VK_KHR_sampler_mirror_clamp_to_edge VK_KHR_sampler_ycbcr_conversion VK_KHR_separate_depth_stencil_layouts
VK_KHR_shader_atomic_int64 VK_KHR_shader_clock VK_KHR_shader_draw_parameters
VK_KHR_shader_float16_int8 VK_KHR_shader_float_controls VK_KHR_shader_integer_dot_product
VK_KHR_shader_non_semantic_info VK_KHR_shader_subgroup_extended_types VK_KHR_shader_subgroup_uniform_control_flow
VK_KHR_shader_terminate_invocation VK_KHR_spirv_1_4 VK_KHR_storage_buffer_storage_class
Swap chain details:
Min/max images in swap chain; 1, 16
Min/max width and height 800 : 600 | 800 : 600
Pixel format codes(at least we need one no matter what!): 44
50 58 97 44 50 58 97 58 97 58
97 97 2 3 4 5 8 37 38 43
45 51 52 57 64 91 92 122
color space codes(at least we need one no matter what!): 0
0 0 0 1000104006 1000104006 1000104006 1000104006 1000104008 1000104008 1000104007
1000104007 1000104002 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
Available presentation modes:
0 (Immediate)
2 3 ( FIFO, FIFO_relaxed)
A few things:
There isn't really enough information in the problem description to allow others to locate the problem. For example, we can't tell how surface got created and we can't tell how the Vulkan device got created. It is better to post a complete reproducible example someplace and point to it.
There are a lot of hits when searching for "vulkan swapchain exception" like this one and this one. Something there may give a clue.
Based on what is provided and the links mentioned above, my best guess is that you're not enabling the swapchain extension when creating the device. Perhaps you could check that?
The validation layer should be helpful and you can find more information about it here. You might try making a vk_layer_settings.txt file and use it to set the message severity to "info" so that you can verify that the layer is active. (It will print some sort of startup message at this level) Your IDE might be swallowing the text output coming from the validation layer and the point behind doing this is to verify that you can see any validation output. It may be easier to provide a log filename in the same settings file to send the validation output to that file instead of figuring out what the IDE is doing. You can also use the vkconfig tool to apply these sorts of settings to the validation layer.

Declare a queue with x-max-length programmatically using Rabbitmq-c

I am implementing a RPC function for my C application , and try to programmatically declare a queue which limits maximum number of pending messages, after reading the declaration of amqp_table_entry_t and amqp_field_value_t in amqp.h , here's my minimal code sample :
int default_channel_id = 1;
int passive = 0;
int durable = 1;
int exclusive = 0;
int auto_delete = 0;
amqp_table_entry_t *q_arg_n_elms = malloc(sizeof(amqp_table_entry_t));
*q_arg_n_elms = (amqp_table_entry_t) {.key = amqp_cstring_bytes("x-max-length"),
.value = {.kind = AMQP_FIELD_KIND_U32, .value = {.u32 = 234 }}};
amqp_table_t q_arg_table = {.num_entries=1, .entries=q_arg_n_elms};
amqp_queue_declare( conn, default_channel_id, amqp_cstring_bytes("my_queue_123"),
passive, durable, exclusive, auto_delete, q_arg_table );
amqp_rpc_reply_t _reply = amqp_get_rpc_reply(conn);
The code above always returns AMQP_RESPONSE_LIBRARY_EXCEPTION in the object of amqp_rpc_reply_t, with error message a socket error occurred , I don't see any active connection triggered by this code in web management UI of the RabbitMQ. so I think rabbitmq-c library doesn't establish a connection and just reply with error.
However everything works perfectly when I replace the argument q_arg_table with default amqp_empty_table (which means no argument).
Here are my questions :
Where can I find the code which filter the invalid key of the queue argument ? according to this article , x-max-length should be correct argument key for limiting number of messages in a queue , but I cannot figure out why the library still reports error.
Is there any example that demonstrates how to properly set up amqp_table_t passing in amqp_queue_declare(...) ?
Development environment :
RabbitMQ v3.2.4
rabbitmq-c v0.11.0
Appreciate any feedback , thanks for reading.
[Edit]
According to the server log rabbit#myhostname-sasl.log, RabbitMQ broker accepted a new connection, found decode error on receiving frame, then close connection immediately. I haven't figured out the Erlang implementation but the root cause is likely the decoding error on the table argument when declaring the queue.
131 =CRASH REPORT==== 18-May-2022::16:05:46 ===
132 crasher:
133 initial call: rabbit_reader:init/2
134 pid: <0.23706.1>
135 registered_name: []
136 exception error: no function clause matching
137 rabbit_binary_parser:parse_field_value(<<105,0,0,1,44>>) (src/rabbit_binary_parser.erl, line 53)
138 in function rabbit_binary_parser:parse_table/1 (src/rabbit_binary_parser.erl, line 44)
139 in call from rabbit_framing_amqp_0_9_1:decode_method_fields/2 (src/rabbit_framing_amqp_0_9_1.erl, line 791)
140 in call from rabbit_command_assembler:process/2 (src/rabbit_command_assembler.erl, line 85)
141 in call from rabbit_reader:process_frame/3 (src/rabbit_reader.erl, line 688)
142 in call from rabbit_reader:handle_input/3 (src/rabbit_reader.erl, line 738)
143 in call from rabbit_reader:recvloop/2 (src/rabbit_reader.erl, line 292)
144 in call from rabbit_reader:run/1 (src/rabbit_reader.erl, line 273)
145 ancestors: [<0.23704.1>,rabbit_tcp_client_sup,rabbit_sup,<0.145.0>]
146 messages: [{'EXIT',#Port<0.31561>,normal}]
147 links: [<0.23704.1>]
148 dictionary: [{{channel,1},
149 {<0.23720.1>,{method,rabbit_framing_amqp_0_9_1}}},
150 {{ch_pid,<0.23720.1>},{1,#Ref<0.0.20.156836>}}]
151 trap_exit: true
152 status: running
153 heap_size: 2586
154 stack_size: 27
155 reductions: 2849
156 neighbours:
RabbitMQ may not support unsigned integers as table values.
Instead try using a signed 32 or 64-bit number (e.g., .value = {.kind = AMQP_FIELD_KIND_I32, .value = {.i32 = 234 }}).
Also the RabbitMQ server logs may contain additional debugging information that can help understand errors like this as well as the amqp_error_string2 function can be used to translate error-code into an error-string.

Convert Oracle RAW of NUMBER to .NET Int64

I have converted this number 735969 to oracle raw this this funcion:
UTL_RAW.CAST_FROM_NUMBER(735969)
and saved to database.
Then I get saved data from .NET application into byte[] variable bytesFromDB.
Content got into variable is
byte[4] { 195, 64, 70, 60 }
If I try to convert it int with this function:
BitConverter.ToInt32(bytesFromDB, 0)
It returns a differente number (1178356419) infact if I convert 735969 into array with .NET function
BitConverter.GetBytes(735969)
I get a different byte array:
byte[4] { 225, 58, 11, 0 }
This is the .Net FIDDLE
This is the Oracle FIDDLE
Why this???
Which is BAD? ORACLE or .NET??

Java mail api 1.5.5 strange behaviour

I am using javamail (1.5.5) to fetch mails from exchange 2010 server. It fails to fetch few messages (java.lang.OutOfMemoryError: Java heap space). But it is working fine when using java mail api 1.4.5 without heap space error.
What's strange here is the size of that peculiar message is 136516 Bytes. So when using IMAP, it should be fetched within 9 batches ( default fetch size is 16KB ). But from the debug trace referred below, something is strange.
Here is my code:
Message messObj = message[i]; String messSubject = null;
String messMsgId = null;
java.io.ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
messObj.writeTo(bos);
bos.close();
javax.mail.util.SharedByteArrayInputStream bis = new javax.mail.util.SharedByteArrayInputStream(bos.toByteArray());
MimeMessage cmsg = new MimeMessage(session, bis);
bis.close(); mp.setMessage(cmsg);
messSubject = cmsg.getSubject();
messMsgId = ((MimeMessage) cmsg).getMessageID();
System.out.println("debugging:::subject::"+messSubject+"::msgid::"+messMsgId);
FLAGS (\Seen \Answered))|
[14:48:21:205]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: A3893 OK FETCH
completed.| [14:48:21:205]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: A3894
FETCH 1 (BODY[]<536512690.16384>)|
[14:48:21:220]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: * 1 FETCH (UID 91149
BODY[] {137921}|
FLAGS (\Seen \Answered))|
[14:48:21:236]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: A3894 OK FETCH
completed.| [14:48:21:236]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: A3895
FETCH 1 (BODY[]<536650611.16384>)|
[14:48:21:251]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: * 1 FETCH (UID 91149
BODY[] {137921}|
--5c3ef07b8737170331214bb435ce7be6--| [14:48:21:267]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: FLAGS (\Seen
\Answered))| [14:48:21:267]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: A3895
OK FETCH completed.| [14:48:21:267]|[09-26-2018]|[SYSOUT]|[INFO]|[73]:
A3896 FETCH 1 (BODY[]<536788532.16384>)|
[14:48:21:283]|[09-26-2018]|[SYSOUT]|[INFO]|[73]: * 1 FETCH (UID 91149
BODY[] {137921}|
Error occurs before the system print. Each time the entire message is fetched and it is fetched for 3896 times ( after that memory heap error occurs and stops the process ). Could someone tell me what am I missing here?

Warning: Invalid stream: "FormatError: Bad FCHECK in flate stream: 120, 239" on PDF response from springboot API after dropzone upload

I'm using dropzone to send files to a springboot api, which processes those files and returns a pdf response, which I want to display on my angular front-end. Everything works fine until time to display the pdf, when it renders a blank pdf (with the correct number of pages) along with the warnings in console:
Warning: Indexing all PDF objects pdf.worker.min.js:1
Warning: Invalid stream: "FormatError: Bad FCHECK in flate stream: 120, 239"
I know that the pdf itself is not corrupt, because when I make a get request to the API to retrieve the stored version of the same pdf, it is not corrupt and renders fine.
I have tried using TextEncoder:
let enc = new TextEncoder();
this.masterPdf = enc.encode(event[1])
using FileReader:
var reader = new FileReader();
  reader.onload = function() {
var arrayBuffer = this.result;
self.masterPdf = new Uint8Array(arrayBuffer);
console.log(self.masterPdf);
self.masterShow = true;
}
var blob = new Blob([event[1]], {type:'application/pdf'});
reader.readAsArrayBuffer(blob);
and using StringToBytes:
let strToByteArr = stringToBytes(event[1]);
this.masterPdf = new Uint8Array(strToByteArr);
event in all of these cases is the response, here it is below (of course the pdf string is actually much longer):
0: File(1237) {upload: {…}, status: "success", accepted: true, processing: true, xhr: XMLHttpRequest, …}
1:"%PDF-1.7↵%����↵1 0 obj↵<</Type/Catalog/Pages 2 0 R/Lang(en-US) /StructTreeRoot 12 0 R/MarkInfo<</Marked true>>/Metadata 32 0 R/ViewerPreferences 33 0 R>>↵endobj↵2 0 obj↵<</Type/Pages/Count 2/Kids[ 3 0 R 9 0 R] >>↵endobj↵3 0 obj↵<</Type/Page/Parent 2 0 R/Resources<</Font<</F1 5 0 R>>/ExtGState<</GS7 7 0 R/GS8 8 0 R>>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/MediaBox[ 0 0 612 792] /Contents 4 0 R/Group<</Type/Group/S/Transparency/CS/DeviceRGB>>/Tabs/S/StructParents 0>>↵endobj↵4 0 obj↵<</Filter/FlateDecode/Length 3808>>↵stream
2: ProgressEvent {isTrusted: true, lengthComputable: true, loaded: 99282, total: 99282, type: "load", …}
I did check those particular bytes (120-239) in the valid file returned versus the invalid one, and they are different, but the invalid one just looked like normal numbers.
When requesting a PDF from an API, set the request's response type to 'blob'. The default type is application/json.
Once the file has been received, create a blob using the response's data then use the blob to create a url.
let blob = new Blob([data], {type: 'application/pdf'})
let url = window.URL.createObjectURL(blob)

Resources