Wierd Dbus Issue - dbus_connection_send fail - dbus

I am a beginner to DBus and wrote one sample application using dbus but i am facing a weird problem. My app is running fine on guest os as Ubuntu (On virtual box with windows host ) but the same app is not working on standalone Ubuntu system (also tried on meego, no luck thr as well).
Then, i verified the obvious doubts on dbus, glib libraries versions. Its same on both the environments, and the issue is consistent. I mean the app always runs without any prob on virtual box and always crashes on the standalone ubuntu.
Here is the brief desc about the issue.
App is supposed to send 150 signals on dbus and another app is
receiving these signals. (No issues here in send & receive).
I have an array of DbusMessage[150] (also tried with the list of 150 DBusMessage)...appending the arguments on to the dbus msg and sending on to bus..one at a time...no looping...
The sequence of dbus APIs are all correct and verified by referencing multiple sample source code.
All of above works fine, but on the standalone ubuntu system, i can always see segmentation fault, on dbus_connection_send() call.
I reverified everypossible places where in "seg faults" can happen and it all looks fine to me. This is how i am appending my arg to dbus message.
dbus_message_append_args(pDbusMsg, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &pData, sizeof(pData),
DBUS_TYPE_INVALID) != TRUE)
then connection send..and then calling dbus_connection_flush(). Also as my app has to send the same message again (but not immediately), i am re registering the same signal by calling dbus_message_new_signal()..i have verified all the pointers / memory / dbusmessage..everything looks fine and works fine on virtualized ubuntu os.
Just to add, i tried sending with dbus_connection_send_preallocated() and it works fine for few messages(10-15~), but not consistent enough.
Have you ever had this kind of issue, please let me know any clue to solve this prob....Any help would be appreciated or any examples/tutorials as well taking into consideration I'm just starting out with dbus :P
Thanks

I dont know if you have heard about dbus related debugging tools. For beginning you can try calling the exposed functions using some dbus-debugging-tool. If it doesnt throw segmentation fault when you call using the tool, then probably you should look for issues in your code. Otherwise you should check things related to environment.
One such tool is - DFeet
Another such debugger(commandline based) is provided by Qt people as well.

Related

Transform Classes With Dex For Debug is making Windows crash

I'm building a React Native app. Everything was working fine but now when I try to run on Android it gets to the task :app:transformClassesWithDexForDebug, it hangs for 30-60 seconds and then Windows shuts down.
I tried to setup multidex as mentioned here: https://stackoverflow.com/a/56875424 but the result is the same.
I'm not getting any error message, the computer just shuts down abruptly and I have to turn it on again.
Any advice is much appreciated.
In the end, it was two problems mixed:
I was using the new Windows Terminal which is still in beta so I guess the shutdown problem was something to do with it, because I changed to normal good ol' cmd and the shutdown problem disappeared.
The actual error in the compilation process was actually the setup of multidex. I was not extending the MultiDexApplication class.
Thank you all.

Starting a graphical application using sfml on Raspberry Pi boot

I would like to make a Graphical interface for a home-made program using SFML on Raspberry Pi2. I am using Raspbian. I recompiled the graphical lib
It works fine unsing startx first, then using my application, which wors perfectly fine.
But I can't figure if it is possible or how to launch my application directly after boot without launching startx (just to optimise the cpu of the Raspberry).
Starting my program direcly after boot, I get the following error:
Failed to open X11 display: make sure the DISPLAY environnement variable is set correctly.
Aborted.
I already tested the classic export DISPLAY=:0.0 but without sucess.
I interested myself in x and xinit, but I am not sure that would even do it.
Where should I start looking? I don't need a complete solution, even a hint or an idea would be nice!
I checked to see if it was possible to open a graphical app without the X desktop environment and as that answer states, with Firefox at least, you need the X server which SFML also probably needs in order to create a window.
The answer states:
Basically something like:
$ X
Then you just start Firefox in this X server:
$ DISPLAY=:0 firefox
You can switch from the X server and the framebuffer by using
CTRL+ALT+F1 and CTRL+ALT+F7.
You could try that and see if it helps.
Also, still searching, I found a forum post on the sfml website about what you're trying to accomplish stating somewhere:
SFML requires OpenGL, so as far as I know you need at least X running,
but you probably don't need gnome, KDE or a similar Desktop
Environment on top.
The forum guy asking for help seems to have managed to get X11 and a SFML basic render window to work on Ubuntu server after someone posted a link to xinitrc. I guess, that's the route to go from here.

How does a Client (Written in C) listens to a request on Linux OS?

I am a beginner and I want to understand some basics of Client-Server applications written in C (I understand web based server-client applications written in Java, PHP ,etc).
To be more specific, I am talking about ZABBIX which is a client-server tool (Zabbix_server is a server and zabbix_agentd is a client, both written in C).
Zabbix_server asks zabbix_agentd for data and zabbix_agents responds accordingly.
I have imported zabbix codes on Eclipse and have tried to debug to understand codes. A complete execution of zabbix_agentd on Eclipse just launched the daemon successfully and created a child process. But when I check the log, I find that different functions are being called which had not come in the way while debugging. It means, these functions are called by some process, may be inetd, etc. (correct me if i am wrong). I tried to find inetd on RHEL 6.4 OS, but it was no where found (using "service inetd status", "find").
So, how those functions are being called? Can anyone please give me ideas about that?
Please suggest me how to use those calling requests to further debug my client application.
One thing I have noticed while debugging Eclipse is that, I get below error after calling fork():
No source available for "fork() at 0x36ca0acbc0"
I couldn't understand the impact of the above error as the daemon keeps on working after this error also.
I browsed through similar error different people getting and found that their binaries were not linked to sources. However, my binaries are linked to sources also. I mean, expanding the binary of zabbix_agentd shows several *.h and *.c files.
As this error terminates the debugger immediately but the line of code at this occurrence is the last line of the source file also. So, I cannot say if I need to take care for this error.
Is this error the reason why I am not able to view other functions being called?
Please let me know if more information is required.
Thanks in advance.
Regards,
Rohit

Serial Port Program crashes (no core dump)

im making a C project for university in Linux, its basicaly a protocol for file transfer between 2 computers. The program works fine and it sends many files without any problem, but there is 1 or 2 files i have tested and the program just crashes without any report and i just dont know how to debug the problem. Any help would be appreciated.
I also dont know if i should post the code or not, because both files (application and protocol) have over 1.5k lines of code.
In most Linux Distributions the core dumping is disable by default (which can be viewed from the system resource limit "ulimit -c" will be zero if it is disabled). To enable the same, use "ulimi -c unlimited".
To add, in Ubuntu like modern distributions, they have customized program to send the report/core file to Ubuntu developers specified in "/proc/sys/kernel/core_pattern". Make sure to change it for development purpose to debug further.
You can even try "valgrind" or "gdb live debugging" to have more clarity about the problem.

Error: pjsip gives `mod_sofia` insetad of the actual phone number

I am working on project in which I use Sipek Voip for connecting to Freeswitch. Here is the situation:
I have a Sangoma A400 hard. I compiled Freeswitch for Windows and now it works perfectly.
I have also created a Softphone using Sipek Voip SDK and it works well with Freeswitch.
The problem is that, when I have an incoming call, instead of showing the callers number, I get mod_sofia.
I looked at Sipek and all it gets from pjsip is a string containing <sip:mod_sofia#192.168.2.10:5060>.
So I went to pjsip and tried to pass the actual phone number to Sipek. I found out there is a function called pjsua_call_on_incoming which handles an incoming call.
It takes an argument of type pjsip_rx_data. It has a string field (rdata->msg_info.msg_buf) which contains the whole message. I tried to replace <sip:mod_sofia#192.168.2.10:5060> with the actual number, but it has no effect.
Does anyone have any idea how to fix this?
You can check this link for tracking the issue. Unfortunately there are hardly any people who can help you out with Open source projects "for free" even on a forum. I just speak from my personal experience. I am facing the same problem, and cannot figure it out till now, though I have solved many issues that I used to face with SIPEK, all on my own.
I've not understood the root of your problem is in FreeSWITCH or in sipek/pjsip.
This entry on FreeSWITCH wiki could help you debug the sip stack in FreeSWITCH:
http://wiki.freeswitch.org/wiki/Mod_sofia#Debugging_Sofia-SIP
in a way similar to a wireshark capture.
I'm sorry I don't know how to help you trace down the parsing/rendering of msg_info.msg_buf in pjsip.
Add sip_contact_user=xxxx in your dialstring.

Resources