Hey Stack Overflow Community,
big thanks to this community, is helping me a lot. However for now i am stucked since a while and cant find any solutions in the web.
Working with the ESP8266 chip is a lot of fun. There are tons of easy examples out there how to connect to servers... using the ESP. At the moment i am writing nested classes to create different client connections.
I like creating "subtasks" using a Ticker/Timer objects (periodic or once callback) to free the cpu. However, as soon i created a new WiFiClient object and the callback function of a Ticker object is invoked, i ll receive a runtime error while the client tries to connect to the host.
It would be a mess to include my whole project and classes, so i wrote this small code, however, it will illustrate my problem.
Both functions void post(int var) and void postPtr(int var) can be call individually, e.g. in the loop(), successfully. However as soon i attach one of those functions to a ticker callback i'll get a run time error.
#ifdef DEBUG_ESP_PORT
#define DEBUG_MSG(...) DEBUG_ESP_PORT.printf( __VA_ARGS__ )
#define debugmode 1
#else
#define debugmode 0
#define DEBUG_MSG(...)
#endif
#include <ESP8266WiFi.h>
#include <Ticker.h>
#ifndef STASSID
#define STASSID "###SSID###"
#define STAPSK "###PWK###"
#endif
Ticker myTicker;
Ticker* myTickerPtr;
WiFiClient* myClientPtr;
const char* ssid = STASSID;
const char* password = STAPSK;
const char* host = "192.168.10.40";
const uint16_t port = 8080;
const char* postMessage = "POST /plug HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded; charset=UTF-8\r\nContent-Length: 14\r\nConnection: close\r\n\r\nname=2&value=1";
static int prevTime=millis();
int cnt=0;
int packages=0;
int speed=0;
//#########################################################################
// checking time duration for code execution
int time() {
int tmp = millis();
int value = tmp - prevTime;
prevTime = tmp;
return value;
}
//#########################################################################
// simple connection / package speed test
void speedtest() {
speed = (cnt - packages)*5;
packages = cnt;
}
//#########################################################################
// connect to host, send a post message, stop connection
void post(int var) {
WiFiClient client;
DEBUG_MSG("[DONE %dms] Client[%d] waiting for connection... \n", time(), var);
while (!client.connect(host, port)) {delay(10);}
DEBUG_MSG("[DONE %dms] Client[%d] connected \n", time(), var);
client.println(postMessage);
client.printf("[DONE %dms] Client[%d] Data Package[%d] Sent. Avg speed: %d\n\n", time(), var, cnt, speed);
DEBUG_MSG("[DONE %dms] Client[%d] Data Package[%d] Sent. Avg speed: %d\n\n", time(), var, cnt, speed);
client.stop();
cnt++;
}
//#########################################################################
// connect to host, send a post message, stop connection (using a WifiClient Pointer)
void postPtr(int var) {
myClientPtr = new WiFiClient;
DEBUG_MSG("[DONE %dms] ClientPtr[%d] waiting for connection... \n", time(), var);
while (!myClientPtr->connect(host, port)) {delay(10);}
DEBUG_MSG("[DONE %dms] ClientPtr[%d] connected \n", time(), var);
myClientPtr->println(postMessage);
myClientPtr->printf("[DONE %dms] ClientPtr[%d] Data Package[%d] Sent. Avg speed: %d\n\n", time(), var, cnt, speed);
DEBUG_MSG("[DONE %dms] ClientPtr[%d] Data Package[%d] Sent. Avg speed: %d\n\n", time(), var, cnt, speed);
myClientPtr->stop();
delete myClientPtr;
cnt++;
}
//#########################################################################
void setup() {
if (debugmode) {
Serial.begin(115200);
while (!Serial) {delay(10);}
}
DEBUG_MSG("\n\n");
DEBUG_MSG("[DONE %dms] Serial done \n", time());
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
DEBUG_MSG("[DONE %dms] Waiting for WiFi connection... \n", time());
while (!WiFi.isConnected()) { delay(10);}
DEBUG_MSG("[DONE %dms] WiFi connected. IP %s\n", time(), WiFi.localIP().toString().c_str());
myTicker.attach_ms(200, speedtest);
//R U N T I M E E R R O R - while in callback function - STACK OVERFLOW !!!
myTickerPtr = new Ticker;
myTickerPtr->once_ms(100, post, 0x02);
//or
//myTickerPtr->attach_ms(100, post, 0x02);
}
//#########################################################################
void loop() {
// calling functions, working fine...
post(0x01);
postPtr(0x01);
//ESP.deepSleep(0);
}
DEBUG MESSAGE:
[DONE 0ms] Serial done
[DONE 5ms] Waiting for WiFi connection...
[DONE 185ms] WiFi connected. IP 192.168.10.88
[DONE 101ms] Client[2] waiting for connection...
Soft WDT reset
>>>stack>>>
ctx: sys
sp: 3fffecb0 end: 3fffffb0 offset: 01b0
3fffee60: 00000000 4020e220 00000030 4010097c
3fffee70: 3ffee63c 3fffeef0 00000030 4020e220
3fffee80: 00000000 3fffeef0 3fffeef0 402034c1
3fffee90: 00001f90 3fffeea0 00000008 60000600
3fffeea0: 401052ec 001fbdcb 3ffee700 00001f90
3fffeeb0: 3ffee63c 00001f90 3fffeef0 40202c54
3fffeec0: 40204810 280aa8c0 402013f0 0000000a
3fffeed0: 3ffe87a4 0000000a 0000000a 402013fb
3fffeee0: 3ffee63c 00000002 3ffe84e0 4020266e
3fffeef0: 40204788 00000000 00001388 00000001
3fffef00: 00000000 00000000 3ffedfc0 00d99aa9
3fffef10: 4010505e 0014fa1c 3ffedfc0 60000600
3fffef20: 00d9d2f2 3ffedfc0 3ffef1a4 40230809
3fffef30: 4023084e 3fffdab0 00000000 3fffdcb0
3fffef40: 3ffedfd0 3fffdad0 3ffee6a8 402040c7
3fffef50: 40000f49 40000f49 3fffdab0 40000f49
3fffef60: 40000e19 40001878 00000002 00000000
3fffef70: 3fffff10 ffffffff ffffffff 401049d0
3fffef80: 401049d6 00000002 00000000 54e55bf8
3fffef90: 4010000d 6f3d99f3 6dad4d79 c13de55d
3fffefa0: 00000000 3fffef3c 00000000 3fffff38
3fffefb0: 3fffffc0 00000000 00000000 feefeffe
3fffefc0: feefeffe feefeffe feefeffe feefeffe
3fffefd0: feefeffe feefeffe feefeffe feefeffe
3fffefe0: feefeffe feefeffe feefeffe feefeffe
...
...
3ffffc20: feefeffe feefeffe feefeffe feefeffe
3ffffc30: feefeffe feefeffe feefeffe feefeffe
3ffffc40: feefeffe feefeffe feefeffe feefeffe
3ffffc50: feefeffe feefeffe feefeffe feefeffe
3ffffc60: feefeffe feefeffe feefeffe feefeffe
3ffffc70: 00000003 00000000 0000000a 00000000
3ffffc80: 00000003 00000000 0000000a 00000000
3ffffc90: feefeffe feefeffe feefeffe feefeffe
3ffffca0: 00000000 a0000000 00000000 0000001c
3ffffcb0: 00003000 feefeffe 00003000 00000000
3ffffcc0: 3ffffe20 00000000 3ffffe20 4020bf66
3ffffcd0: 0000a000 3ffffdc3 3ffe8e01 00000008
3ffffce0: 4022a65a 3ffeedec 40207ce0 0000000d
3ffffcf0: 3ffffe20 0000000d 3ffffe20 4020bf66
3ffffd00: 3ffffd80 3ffef434 3ffffd30 00000000
3ffffd10: 3ffe8cb0 40229717 3ffeedec 4020bea0
3ffffd20: 3ffffe20 3ffef434 3ffffd80 40207de0
3ffffd30: 0000000d 0000002c 0000002c 00000001
3ffffd40: 00000000 00000001 3ffffe20 4020bf66
3ffffd50: 3ffffdc3 3ffe8681 00000000 4021f23f
3ffffd60: 3ffed780 4021ee10 40221480 3ffe8681
3ffffd70: 00000000 3ffe8682 3ffffe20 4020c150
3ffffd80: 00000000 0000000d 00000000 00000000
3ffffd90: 0000000d 0000002f 40302073 3ffed878
3ffffda0: 3ffed8b0 40221480 3ffed780 aa55aa55
3ffffdb0: 3ffed110 40220d8c 3ffed08c 33000012
3ffffdc0: 00353239 4021edd4 3ffed110 00000012
3ffffdd0: 4021ed9f 3ffed08c 00000000 40232c0d
3ffffde0: 3fffff50 3fffff20 00000010 3ffe8304
3ffffdf0: 00000002 00000000 00000020 401014c2
3ffffe00: 3ffe8cb2 401048ac 3ffec420 3ffee6a8
3ffffe10: 00000001 40103acf 3ffece78 402096c9
3ffffe20: 40103f32 3ffe84ec 00000010 ffff0208
3ffffe30: 3ffffed0 0000003f 3fffc200 00000022
3ffffe40: 40103a16 0000002c 7fffffff 00000002
3ffffe50: 0000012c 00000030 0000001e ffffffff
3ffffe60: 4010288b 00080000 3fffff40 40203d5c
3ffffe70: 00000000 0000000a 00002200 4000050c
3ffffe80: 00000000 00000000 0000001f 401051a9
3ffffe90: 00000000 00000000 0000001f 401051a9
3ffffea0: 4000050c 00000030 00000010 ffffffff
3ffffeb0: 402041d4 00000030 00000011 ffffffff
3ffffec0: 402041d4 000000a0 3fffc704 00000001
3ffffed0: 00000000 00000000 00000000 fffffffe
3ffffee0: ffffffff 3fffc6fc 00000001 3ffe851c
3ffffef0: 00000000 3fffdad0 3ffee6a8 00000030
3fffff00: 401052ec 0014fa1c 3ffef1a4 00000000
3fffff10: 3ffedfc0 3ffef1a4 00000020 401009a2
3fffff20: 00000000 0014800a 402036bc 3ffef42c
3fffff30: 00000000 00000064 00000002 4020369e
3fffff40: 4020262c 4020e220 00000020 401009a2
3fffff50: 00000000 3ffee608 00000014 3ffee6a8
3fffff60: 00000f55 3ffee608 3ffef42c 4020259c
3fffff70: 00000000 00000000 00000000 00000000
3fffff80: 402023ac 580aa8c0 402043e0 402043cc
3fffff90: 00000000 00000000 00000001 4020415d
3fffffa0: 3fffdad0 00000000 3ffee674 402041ee
<<<stack<<<
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
I would appreciate any help, recommendations or advices. Thanks for reading :D
Related
**I use Flutter Downloader Package After complete download some file , my app closes automatically and disconnecte to the android studio. Any one help me to find soltutions.
final status = await Permission.storage.request();
if (status.isGranted) {
await downloadPDF();
}
downloadPDF() async {
final externalDir = await getExternalStorageDirectory();
taskId = await FlutterDownloader.enqueue(
url: pdfURL,
savedDir: externalDir.path,
fileName: "Flamingo Order Details",
showNotification: true,
openFileFromNotification: true,
);
}
Here is my console error:
I/flutter (15913): Fatal: could not find callback
F/libc (15913): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 15956 (1.raster), pid 15913 (le.order_system)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'motorola/chef/chef_sprout:10/QPTS30.61-18-16-8/03acd:user/release-keys'
Revision: 'pvt'
ABI: 'arm64'
Timestamp: 2021-04-23 16:39:38+0530
pid: 15913, tid: 15956, name: 1.raster >>> com.example.order_system <<<
uid: 10870
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
x0 000000741e5a6478 x1 00000074841cfa00 x2 0000000000000001 x3 0000000000000000
x4 0000000000000000 x5 00000000ffffffff x6 00000000ffffffff x7 0000000b96c6a75c
x8 0000000080000081 x9 658adf78f7e836ee x10 0000000000000000 x11 0000000000000000
x12 0000000000000001 x13 000000747b19fe80 x14 0000007489a0a280 x15 0000000000000000
x16 000000747b19b050 x17 0000007515c9787c x18 000000741d05e000 x19 000000741e5a6478
x20 00000074841cfa00 x21 0000000000000001 x22 0000000000000000 x23 00000074843db380
x24 000000741e5a7020 x25 000000741e5a7020 x26 0000000000000000 x27 0000000000000001
x28 0000000000000043 x29 000000741e5a6450
sp 000000741e5a6420 lr 000000747b013f84 pc 000000747b01c378
backtrace:
#00 pc 00000000001d8378 /vendor/lib64/egl/libGLESv2_adreno.so (BuildId: 22cc95e0051ae85072c405eeeeeb312d)
#01 pc 00000000001cff80 /vendor/lib64/egl/libGLESv2_adreno.so (BuildId: 22cc95e0051ae85072c405eeeeeb312d)
#02 pc 00000000000207b0 /system/lib64/libEGL.so (android::eglSwapBuffersWithDamageKHRImpl(void*, void*, int*, int)+316) (BuildId: 248ba7f2d80e7bb9952a20e1c3493c86)
#03 pc 000000000001d0a8 /system/lib64/libEGL.so (eglSwapBuffers+80) (BuildId: 248ba7f2d80e7bb9952a20e1c3493c86)
#04 pc 00000000012ec528 /data/app/com.example.order_system-8XYsushVsEZPOltQ3k8npA==/lib/arm64/libflutter.so (BuildId: e14966237eb013b063fed6484195268f7398b594)
Lost connection to device.
Maybe it is late but it may help others. Recently I faced this error and I solved it. Your UI is rendering in Main isolate and your download events come from background isolate. Because codes in callback are run in the background isolate, so you have to handle the communication between two isolates. Usually, communication needs to take place to show download progress in the main UI. Implement the below code to handle communication:
import 'dart:isolate';
import 'dart:ui'; // You need to import these 2 libraries besides another libraries to work with this code
final ReceivePort _port = ReceivePort();
#override
void initState() {
super.initState();
IsolateNameServer.registerPortWithName(_port.sendPort, 'downloader_send_port');
_port.listen((dynamic data) {
String id = data[0];
DownloadTaskStatus status = data[1];
int progress = data[2];
setState((){ });
});
FlutterDownloader.registerCallback(downloadCallback);
}
#override
void dispose() {
IsolateNameServer.removePortNameMapping('downloader_send_port');
super.dispose();
}
static void downloadCallback(String id, DownloadTaskStatus status, int progress) {
final SendPort send = IsolateNameServer.lookupPortByName('downloader_send_port')!;
send.send([id, status, progress]);
}
void _download(String url) async {
final status = await Permission.storage.request();
if(status.isGranted) {
final externalDir = await getExternalStorageDirectory();
final id = await FlutterDownloader.enqueue(
url: url,
savedDir: externalDir!.path,
showNotification: true,
openFileFromNotification: true,
);
} else {
print('Permission Denied');
}
}
Call _download(url) function in your button and you are ready to go.
N.B: I am using sound null safety in my app and for this reason I am using null aware operator in this line of code:
final SendPort send = IsolateNameServer.lookupPortByName('downloader_send_port')!;
I took a crash dump of my application when I got the "An item with the same key has already been added" exception. I need help finding which object caused this exception. I could print the exception but couldn't figure out how to find the exact key that caused the exception.
This is likely the state you have:
[...]
(3250.7ec): CLR exception - code e0434352 (!!! second chance !!!)
[...]
0:000> .loadby sos clr
0:000> !pe
Exception object: 030c31e8
Exception type: System.ArgumentException
Message: An item with the same key has already been added.
InnerException: <none>
StackTrace (generated):
SP IP Function
010FEE1C 6045F705 mscorlib_ni!System.ThrowHelper.ThrowArgumentException(System.ExceptionResource)+0x35
010FEE2C 609410C7 mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Insert(System.__Canon, System.__Canon, Boolean)+0xc6af67
010FEE60 5FD4B310 mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].Add(System.__Canon, System.__Canon)+0x10
010FEE68 017004F5 KeyAlreadyAdded!KeyAlreadyAdded.Program.Main()+0x45
[...]
In the native call stack, you can see the call to Dictionary.Add() again, but with the additional information for the frame number:
0:000> k
# ChildEBP RetAddr
00 010fecb0 618fac03 KERNELBASE!RaiseException+0x62
01 010fed4c 618fae08 clr!RaiseTheExceptionInternalOnly+0x27c
02 010fee14 6045f705 clr!IL_Throw+0x141
03 010fee24 609410c7 mscorlib_ni!System.ThrowHelper.ThrowArgumentException(System.ExceptionResource)$##6000335+0x35
04 010fee50 5fd4b310 mscorlib_ni![COLD] System.Collections.Generic.Dictionary`2[System.__Canon,System.__Canon].Insert(System.__Canon, System.__Canon, Boolean)$##6003922+0x87
05 010fee68 6181ebe6 mscorlib_ni!System.Collections.Generic.Dictionary`2[System.__Canon,System.__Canon].Add(System.__Canon, System.__Canon)$##6003915+0x10
[...]
At the Insert() method, you can use the ebx register to get the key:
0:000> .frame /r 4
04 010fee50 5fd4b310 mscorlib_ni![COLD] System.Collections.Generic.Dictionary`2[System.__Canon,System.__Canon].Insert(System.__Canon, System.__Canon, Boolean)$##6003922+0x87
eax=010fec58 ebx=030c2364 ecx=00000005 edx=00000000 esi=030c23b0 edi=030c2364
[...]
0:000> !do 030c2364
Name: System.String
MethodTable: 5fdefd60
EEClass: 5f9c4e90
Size: 22(0x16) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
String: this
[...]
So in this case, the duplicate key being added is the string "this". Here's the code:
using System.Collections.Generic;
namespace KeyAlreadyAdded
{
class Program
{
static Dictionary<string, string> dict = new Dictionary<string, string> {{"this", "was already inside"}};
static void Main()
{
dict.Add("that", "goes in easily");
dict.Add("this", "however, causes a duplicate key exception");
}
}
}
I created an Iot Edge solution using Visual Studio Code via View -> Command Palette... -> AzureIotEdge:NewIoTEdgeSolution using the C# Module Module Template. This generates an Iot Edge solution with two Modules: tempSensor creates messages with dummy telemetry-data and SampleModule is supposed to receive those messages, print them and then pass them on to IotHub.
I build the solution for arm32 and deployed it to a Rasperry Pi (running latest Raspbian). The modules are then displayed as running on the device but if I monitor d2c-messages there are none arriving in IoT Hub.
If I run sudo iotedge logs tempSensor -f on the device, I can see messages are being generated.
If I run sudo iotedge logs SampleModule -f I only see IoT Hub module client initialized. Which is logged in the Init() Method. There is no logging from the PipeMessage Method which seems not to be reached at all.
If I build the solution for amd64 and deploy it to a virtual machine, everything is working as expected.
Is there a way to get it working on a Raspberry Pi running Raspian?
By the way: I tried the Azure Functions C# Module Template as well. Same result: On amd64 it works but on arm32 it does not.
UPDATE:
Here is the logging of edgeAgent:
█████╗ ███████╗██╗ ██╗██████╗ ███████╗
██╔══██╗╚══███╔╝██║ ██║██╔══██╗██╔════╝
███████║ ███╔╝ ██║ ██║██████╔╝█████╗
██╔══██║ ███╔╝ ██║ ██║██╔══██╗██╔══╝
██║ ██║███████╗╚██████╔╝██║ ██║███████╗
╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
██╗ ██████╗ ████████╗ ███████╗██████╗ ██████╗ ███████╗
██║██╔═══██╗╚══██╔══╝ ██╔════╝██╔══██╗██╔════╝ ██╔════╝
██║██║ ██║ ██║ █████╗ ██║ ██║██║ ███╗█████╗
██║██║ ██║ ██║ ██╔══╝ ██║ ██║██║ ██║██╔══╝
██║╚██████╔╝ ██║ ███████╗██████╔╝╚██████╔╝███████╗
╚═╝ ╚═════╝ ╚═╝ ╚══════╝╚═════╝ ╚═════╝ ╚══════╝
2018-12-21 07:08:27.323 +00:00 [INF] - Edge agent attempting to connect to IoT Hub via Amqp_Tcp_Only...
2018-12-21 07:08:31.986 +00:00 [INF] - Created persistent store at /tmp/edgeAgent
2018-12-21 07:08:34.193 +00:00 [INF] - Edge agent connected to IoT Hub via Amqp_Tcp_Only.
2018-12-21 07:08:37.624 +00:00 [INF] - Plan execution started for deployment 8
2018-12-21 07:08:37.654 +00:00 [INF] - Executing command: "Stop module SampleModule"
2018-12-21 07:08:37.766 +00:00 [INF] - Executing command: "Remove module SampleModule"
2018-12-21 07:08:37.964 +00:00 [INF] - Executing command: "Saving SampleModule to store"
2018-12-21 07:08:38.141 +00:00 [INF] - Executing command: "Command Group: (
[Create module SampleModule2]
[Start module SampleModule2]
)"
2018-12-21 07:08:38.152 +00:00 [INF] - Executing command: "Create module SampleModule2"
2018-12-21 07:08:42.678 +00:00 [INF] - Executing command: "Start module SampleModule2"
2018-12-21 07:08:45.749 +00:00 [INF] - Executing command: "Command Group: (
[Stop module tempSensor]
[Start module tempSensor]
[Saving tempSensor to store]
)"
2018-12-21 07:08:45.750 +00:00 [INF] - Executing command: "Stop module tempSensor"
2018-12-21 07:08:45.759 +00:00 [INF] - Executing command: "Start module tempSensor"
2018-12-21 07:08:48.423 +00:00 [INF] - Executing command: "Saving tempSensor to store"
2018-12-21 07:08:48.491 +00:00 [INF] - Executing command: "Command Group: (
[Stop module edgeHub]
[Start module edgeHub]
[Saving edgeHub to store]
)"
2018-12-21 07:08:48.491 +00:00 [INF] - Executing command: "Stop module edgeHub"
2018-12-21 07:08:48.501 +00:00 [INF] - Executing command: "Start module edgeHub"
2018-12-21 07:08:51.895 +00:00 [INF] - Executing command: "Saving edgeHub to store"
2018-12-21 07:08:51.900 +00:00 [INF] - Plan execution ended for deployment 8
2018-12-21 07:08:52.743 +00:00 [INF] - Updated reported properties
2018-12-21 07:08:57.811 +00:00 [INF] - HealthRestartPlanner is clearing restart stats for module 'tempSensor' as it has been running healthy for 00:10:00.
2018-12-21 07:08:57.814 +00:00 [INF] - HealthRestartPlanner is clearing restart stats for module 'edgeHub' as it has been running healthy for 00:10:00.
2018-12-21 07:08:57.815 +00:00 [INF] - Plan execution started for deployment 8
2018-12-21 07:08:57.818 +00:00 [INF] - Executing command: "Saving tempSensor to store"
2018-12-21 07:08:57.819 +00:00 [INF] - Executing command: "Saving edgeHub to store"
2018-12-21 07:08:57.820 +00:00 [INF] - Plan execution ended for deployment 8
2018-12-21 07:08:58.038 +00:00 [INF] - Updated reported properties
2018-12-21 07:09:03.239 +00:00 [INF] - Updated reported properties
And here some of the logging of edgeHub (there is lots more but seems to be all the same Exceptions):
2018-12-21 07:28:23.450 +00:00 [WRN] - Error sending messages to module bewaPi1/SampleModule2
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
2018-12-21 07:28:28.517 +00:00 [WRN] - Non retryable exception occurred while sending message.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
2018-12-21 07:28:28.521 +00:00 [WRN] - Error sending messages to module bewaPi1/SampleModule2
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
2018-12-21 07:28:33.666 +00:00 [WRN] - Non retryable exception occurred while sending message.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
2018-12-21 07:28:33.669 +00:00 [WRN] - Error sending messages to module bewaPi1/SampleModule2
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
2018-12-21 07:28:39.012 +00:00 [WRN] - Non retryable exception occurred while sending message.
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
2018-12-21 07:28:39.015 +00:00 [WRN] - Error sending messages to module bewaPi1/SampleModule2
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at DotNetty.Buffers.HeapArena.NewChunk(Int32 pageSize, Int32 maxOrder, Int32 pageShifts, Int32 chunkSize)
at DotNetty.Buffers.PoolArena`1.AllocateNormal(PooledByteBuffer`1 buf, Int32 reqCapacity, Int32 normCapacity)
at DotNetty.Buffers.PoolArena`1.Allocate(PoolThreadCache`1 cache, PooledByteBuffer`1 buf, Int32 reqCapacity)
at DotNetty.Buffers.PooledByteBufferAllocator.NewHeapBuffer(Int32 initialCapacity, Int32 maxCapacity)
at DotNetty.Buffers.AbstractByteBufferAllocator.Buffer(Int32 initialCapacity, Int32 maxCapacity)
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ByteBufferConverter.ToByteBuffer(Byte[] bytes) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ByteBufferConverter.cs:line 39
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.ProtocolGatewayMessageConverter.FromMessage(IMessage message) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/ProtocolGatewayMessageConverter.cs:line 101
at Microsoft.Azure.Devices.Edge.Hub.Mqtt.DeviceProxy.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Mqtt/DeviceProxy.cs:line 73
at Microsoft.Azure.Devices.Edge.Hub.Core.Device.DeviceMessageHandler.SendMessageAsync(IMessage message, String input) in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/device/DeviceMessageHandler.cs:line 256
at Microsoft.Azure.Devices.Edge.Hub.Core.Routing.ModuleEndpoint.ModuleMessageProcessor.<>c__DisplayClass5_2.<<ProcessAsync>b__0>d.MoveNext() in /home/vsts/work/1/s/edge-hub/src/Microsoft.Azure.Devices.Edge.Hub.Core/routing/ModuleEndpoint.cs:line 98
So the problem is caused by System.OutOfMemoryExceptions. But what is causing those exceptions?
Update2: This seems to be a known problem (see here) and can be solved by Setting OptimizeForPerformance to false. I will try this and see if it works.
The message routing between modules does not work because of System.OutOfMemoryExceptions in the edgeHub module. The problem is described and discussed here.
Microsoft has implemented a solution which is described here.
In short: If running IotEdge Solutions on Raspberry Pi the environment variable OptimizeForPerformance has to be set to false.
Seems the issue related to
https://learn.microsoft.com/en-us/azure/iot-edge/troubleshoot#stability-issues-on-resource-constrained-devices
Please refer the link and turn off OptimizeForPerformance in deployment manifest.
I'm getting the following linker errors in types.hpp while compiling in vc++ 2017. How shall i solve them ?
Below is the code I'm tyring to compile in vc++.
Additional directories included.
E:\boost_1_61_0-bin-msvc-all-32-64\boost_1_61_0;E:\nosql_db\mongo-cxx-driver-r3.1.3\include\mongocxx\v_noabi;E:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi;E:\nosql_db\mon-c-driver\include\libbson-1.0;E:\nosql_db\mon-c-driver\include\libmongoc-1.0;%(AdditionalDependencies)
#include "stdafx.h"
#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
using bsoncxx::builder::stream::document;
int main()
{
mongocxx::instance inst{};
mongocxx::client conn{ mongocxx::uri{} };
bsoncxx::builder::stream::document document{};
auto collection = conn["testdb"]["testcollection"];
document << "hello" << "world";
collection.insert_one(document.view());
auto cursor = collection.find({});
for (auto&& doc : cursor) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
return 0;
}
everity Code Description Project File Line Suppression State
Error (active) E0145 member "bsoncxx::v_noabi::types::b_double::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 86
Error (active) E0145 member "bsoncxx::v_noabi::types::b_utf8::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 111
Error (active) E0145 member "bsoncxx::v_noabi::types::b_document::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 149
Error (active) E0145 member "bsoncxx::v_noabi::types::b_array::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 181
Error (active) E0145 member "bsoncxx::v_noabi::types::b_binary::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 206
Error (active) E0145 member "bsoncxx::v_noabi::types::b_undefined::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 230
Error (active) E0145 member "bsoncxx::v_noabi::types::b_oid::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 246
Error (active) E0145 member "bsoncxx::v_noabi::types::b_bool::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 264
Error (active) E0145 member "bsoncxx::v_noabi::types::b_date::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 289
Error (active) E0145 member "bsoncxx::v_noabi::types::b_null::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 350
Error (active) E0145 member "bsoncxx::v_noabi::types::b_regex::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 366
Error (active) E0145 member "bsoncxx::v_noabi::types::b_dbpointer::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 402
Error (active) E0145 member "bsoncxx::v_noabi::types::b_code::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 421
Error (active) E0145 member "bsoncxx::v_noabi::types::b_symbol::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 462
Error (active) E0145 member "bsoncxx::v_noabi::types::b_codewscope::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 500
Error (active) E0145 member "bsoncxx::v_noabi::types::b_int32::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 533
Error (active) E0145 member "bsoncxx::v_noabi::types::b_timestamp::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 562
Error (active) E0145 member "bsoncxx::v_noabi::types::b_int64::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 581
Error (active) E0145 member "bsoncxx::v_noabi::types::b_decimal128::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 606
Error (active) E0145 member "bsoncxx::v_noabi::types::b_minkey::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 637
Error (active) E0145 member "bsoncxx::v_noabi::types::b_maxkey::type_id" may not be initialized textapp e:\nosql_db\mongo-cxx-driver-r3.1.3\include\bsoncxx\v_noabi\bsoncxx\types.hpp 653
Error LNK1107 invalid or corrupt file: cannot read at 0x398 textapp E:\nosql_db\mongo-cxx-driver-r3.1.3\bin\mongocxx.dll 1
Steps followed for installing the driver.
cmake -G "Visual Studio 14 2015 Win64" "-DCMAKE_INSTALL_PREFIX=E:\\nosql_db\\mongo-c-driver" "-DCMAKE_BUILD_TYPE=Release"
msbuild.exe /p:Configuration=Release ALL_BUILD.vcxproj
msbuild.exe /p:Configuration=Release INSTALL.vcxproj
cmake -G "Visual Studio 14 2015 Win64" "-DENABLE_SSL=WINDOWS" "-DENABLE_SASL=SSPI" "-DCMAKE_INSTALL_PREFIX=E:\\nosql_db\\mongo-c-driver1" "-DCMAKE_PREFIX_PATH=E:\\nosql_db\\mongo-c-driver" "-DCMAKE_BUILD_TYPE=Release"
msbuild.exe /p:Configuration=Release ALL_BUILD.vcxproj
msbuild.exe /p:Configuration=Release INSTALL.vcxproj
cmake.exe -G "Visual Studio 14 Win64" -DCMAKE_INSTALL_PREFIX=E:\\nosql_db\\mongo-cxx-driver1 -DCMAKE_PREFIX_PATH=E:\\nosql_db\\mon-c-driver -DBOOST_ROOT=E:\\boost_1_65_1
msbuild.exe ALL_BUILD.vcxproj
msbuild.exe INSTALL.vcxproj
Then added additional libraries in vc++ configuration.
E:\nosql_db\mongo-cxx-driver1\include\bsoncxx\v_noabi;E:\nosql_db\mongo-cxx-driver1\include\mongocxx\v_noabi;E:\nosql_db\mon-c-driver\include\libbson-1.0;E:\nosql_db\mon-c-driver\include\libmongoc-1.0;
E:\nosql_db\mongo-cxx-driver1\bin\mongocxx.dll;E:\nosql_db\mongo-cxx-driver1\bin\bsoncxx.dll;E:\nosql_db\mon-c-driver\bin\libbson-1.0.dll;E:\nosql_db\mon-c-driver\bin\libmongoc-1.0.dll;
Here are my linker settings:
/MANIFEST /LTCG:incremental /NXCOMPAT /PDB:"E:\workouts\cpp\textapp\textapp\x64\Release\textapp.pdb" /DYNAMICBASE "mongocxx.dll" "bsoncxx.dll" "libbson-1.0.dll" "libmongoc-1.0.dll" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /IMPLIB:"E:\nosql_db\mongo-cxx-driver1\bin\mongocxx.dll;E:\nosql_db\mongo-cxx-driver1\bin\bsoncxx.dll;E:\nosql_db\mon-c-driver\bin\libbson-1.0.dll;E:\nosql_db\mon-c-driver\bin\libmongoc-1.0.dll;" /DEBUG:FULL /MACHINE:X64 /OPT:REF /INCREMENTAL:NO /PGD:"E:\workouts\cpp\textapp\textapp\x64\Release\textapp.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\textapp.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\bsoncxx.lib" /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\libbsoncxx.lib" /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\libmongocxx.lib" /LIBPATH:"E:\nosql_db\mongo-cxx-driver1\lib\mongocxx.lib" /LIBPATH:"E:\nosql_db\mon-c-driver\lib\bson-1.0.lib" /LIBPATH:"E:\nosql_db\mon-c-driver\lib\mongoc-1.0.lib" /TLBID:1
I have finished evaluating jxbrowser integration with Eclipse for Windows and Linux. My last roadblock is Mac. I get a dead lock while instantiating the browser. I am new to cocoa programming, so any pointer will be greatly appreciated.
I took the example project and modify it to work with SWT.
import java.awt.BorderLayout;
import java.awt.Frame;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
public class JxBrowserApp {
public static void main(String[] args) {
final Display display = new Display();
final Shell shell = new Shell(display);
Composite composite = new Composite(shell, SWT.EMBEDDED | SWT.NO_BACKGROUND);
Frame frame = SWT_AWT.new_Frame(composite);
Browser browser = new Browser(); // deadlock here
BrowserView browserView = new BrowserView(browser);
frame.add(browserView, BorderLayout.CENTER);
frame.setLocationRelativeTo(null);
frame.setFocusable(true);
browser.loadURL("http://www.google.com");
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
Here is the callstack
JxBrowserApp at localhost:57970
Thread [main] (Suspended)
owns: IPC (id=72)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.parkNanos(Object, long) line: 215
CountDownLatch$Sync(AbstractQueuedSynchronizer).doAcquireSharedNanos(int, long) line: 1037
CountDownLatch$Sync(AbstractQueuedSynchronizer).tryAcquireSharedNanos(int, long) line: 1328
CountDownLatch.await(long, TimeUnit) line: 277
LatchUtil.await(CountDownLatch, RuntimeException, int) line: 25
LatchUtil.await(CountDownLatch, RuntimeException) line: 20
IPC.a(boolean) line: 159
IPC.start() line: 128
Browser.<init>(BrowserType, BrowserContext, Channel) line: 195
Browser.<init>(BrowserType, BrowserContext) line: 172
Browser.<init>(BrowserContext) line: 139
Browser.<init>() line: 125
JxBrowserApp.main(String[]) line: 27
Thread [AWT-EventQueue-0] (Suspended)
CPlatformView.nativeCreateView(int, int, int, int, long) line: not available [native method]
CPlatformView.initialize(LWWindowPeer, CPlatformResponder) line: 61
CViewPlatformEmbeddedFrame.initialize(Window, LWWindowPeer, PlatformWindow) line: 55
LWWindowPeer.<init>(Window, PlatformComponent, PlatformWindow, LWWindowPeer$PeerType) line: 156
LWCToolkit(LWToolkit).createDelegatedPeer(Window, PlatformComponent, PlatformWindow, LWWindowPeer$PeerType) line: 210
LWCToolkit.createEmbeddedFrame(CViewEmbeddedFrame) line: 204
CViewEmbeddedFrame.addNotify() line: 55
SWT_AWT$1.run() line: not available
InvocationEvent.dispatch() line: 311
EventQueue.dispatchEventImpl(AWTEvent, Object) line: 756
EventQueue.access$500(EventQueue, AWTEvent, Object) line: 97
EventQueue$3.run() line: 709
EventQueue$3.run() line: 703
AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]
ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(PrivilegedAction<T>, AccessControlContext, AccessControlContext) line: 76
EventQueue.dispatchEvent(AWTEvent) line: 726
EventDispatchThread.pumpOneEventForFilters(int) line: 201
EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: 116
EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 105
EventDispatchThread.pumpEvents(int, Conditional) line: 101
EventDispatchThread.pumpEvents(Conditional) line: 93
EventDispatchThread.run() line: 82
Daemon Thread [Timer-0] (Suspended)
waiting for: TaskQueue (id=87)
Object.wait(long) line: not available [native method]
TimerThread.mainLoop() line: 552
TimerThread.run() line: 505
Daemon Thread [IPC Server Thread] (Suspended)
PlainSocketImpl.socketAccept(SocketImpl) line: not available [native method]
SocksSocketImpl(AbstractPlainSocketImpl).accept(SocketImpl) line: 409
ServerSocket.implAccept(Socket) line: 545
ServerSocket.accept() line: 513
Server.start(int) line: 81
e.run() line: 1237
Thread.run() line: 745
Daemon Thread [IPC Process Thread] (Suspended)
CGraphicsDevice.nativeGetScreenInsets(int) line: not available [native method]
CGraphicsDevice.getScreenInsets() line: 128
LWCToolkit.getScreenInsets(GraphicsConfiguration) line: 407
SwingUtilities$SharedOwnerFrame(Window).init(GraphicsConfiguration) line: 506
SwingUtilities$SharedOwnerFrame(Window).<init>() line: 537
SwingUtilities$SharedOwnerFrame(Frame).<init>(String) line: 420
SwingUtilities$SharedOwnerFrame(Frame).<init>() line: 385
SwingUtilities$SharedOwnerFrame.<init>() line: 1758
SwingUtilities.getSharedOwnerFrame() line: 1833
JWindow.<init>(Frame) line: 187
JWindow.<init>() line: 139
InternalChromiumProcess.doStart(List<String>) line: 1078
InternalChromiumProcess(ChromiumProcess).start(int) line: 123
d.run() line: 184
Thread.run() line: 745