Segmentation Fault error in nesC for Flooding packet acknowledgement using TinyOS - tinyos

For my assignment, I am meant to implement Flooding on a network topology. The following is the code for which the when the packet has reached its final destination and I want to return an acknowledgement. The segmentation fault seems to happen at the if-statement: if(myMsg->protocol == PROTOCOL_PING). Why is this happening and how can it be fixed?
event message_t* receiveFlood.receive(message_t* msg, void* payload, uint8_t len){
dbg(FLOODING_CHANNEL, "Packet Received: %s\n", msg);
if(len==sizeof(pack)){
pack* myMsg=(pack*) payload;
if(myMsg->TTL == 0){
return msg;
}
if(CheckCache(myMsg)){
return msg;
}
//We have reached the destination of the packet
else if(TOS_NODE_ID == myMsg->dest){
dbg(GENERAL_CHANNEL, "The packet has reached its destination with the message: %s\n", myMsg->payload);
dbg(FLOODING_CHANNEL, "[Src:Dest] %d : %d\n", myMsg->src, myMsg->dest);
printf("Hello what is going on \n");
//This statement is the acknowledgement to the src NODE
if(myMsg->protocol == PROTOCOL_PING){
dbg(GENERAL_CHANNEL, "Acknowledged: %s\n");
dbg(FLOODING_CHANNEL, "[Dest:Src] %d : %d\n", myMsg->dest, myMsg->src);
dbg(GENERAL_CHANNEL, "Payload: %s\n:", myMsg->payload);
//Cache the packet
dbg(GENERAL_CHANNEL, "Now Storing msg into cache... %s\n");
NodeCache(myMsg);
return msg;
}
return msg;
}
dbg(FLOODING_CHANNEL, "Package Payload: %s\n", myMsg->payload);
return msg;
}
dbg(GENERAL_CHANNEL, "Unknown Packet Type %d\n", len);
return msg;
}
The following is the output result:
enter code here
Creating Topo!
Number of Motes 19
1 2 -54.0
2 3 -54.0
3 4 -54.0
4 5 -54.0
5 6 -54.0
6 7 -54.0
7 8 -54.0
8 9 -54.0
9 10 -54.0
10 11 -54.0
11 12 -54.0
12 13 -54.0
13 14 -54.0
14 15 -54.0
15 16 -54.0
16 17 -54.0
17 18 -54.0
18 19 -54.0
2 1 -54.0
3 2 -54.0
4 3 -54.0
5 4 -54.0
6 5 -54.0
7 6 -54.0
8 7 -54.0
9 8 -54.0
10 9 -54.0
11 10 -54.0
12 11 -54.0
13 12 -54.0
14 13 -54.0
15 14 -54.0
16 15 -54.0
17 16 -54.0
18 17 -54.0
19 18 -54.0
Creating noise model for 1
Creating noise model for 2
Creating noise model for 3
Creating noise model for 4
Creating noise model for 5
Creating noise model for 6
Creating noise model for 7
Creating noise model for 8
Creating noise model for 9
Creating noise model for 10
Creating noise model for 11
Creating noise model for 12
Creating noise model for 13
Creating noise model for 14
Creating noise model for 15
Creating noise model for 16
Creating noise model for 17
Creating noise model for 18
Creating noise model for 19
Adding Channel command
Adding Channel general
Adding Channel flooding
0:0:0.000000133 DEBUG (1): Booted
0:0:0.000000143 DEBUG (1): Radio On
0:0:0.000000266 DEBUG (2): Booted
0:0:0.000000276 DEBUG (2): Radio On
0:0:0.000000399 DEBUG (3): Booted
0:0:0.000000409 DEBUG (3): Radio On
0:0:0.000000533 DEBUG (4): Booted
0:0:0.000000543 DEBUG (4): Radio On
0:0:0.000000666 DEBUG (5): Booted
0:0:0.000000676 DEBUG (5): Radio On
0:0:0.000000799 DEBUG (6): Booted
0:0:0.000000809 DEBUG (6): Radio On
0:0:0.000000933 DEBUG (7): Booted
0:0:0.000000943 DEBUG (7): Radio On
0:0:0.000001066 DEBUG (8): Booted
0:0:0.000001076 DEBUG (8): Radio On
0:0:0.000001199 DEBUG (9): Booted
0:0:0.000001209 DEBUG (9): Radio On
0:0:0.000001333 DEBUG (10): Booted
0:0:0.000001343 DEBUG (10): Radio On
0:0:0.000001466 DEBUG (11): Booted
0:0:0.000001476 DEBUG (11): Radio On
0:0:0.000001599 DEBUG (12): Booted
0:0:0.000001609 DEBUG (12): Radio On
0:0:0.000001732 DEBUG (13): Booted
0:0:0.000001742 DEBUG (13): Radio On
0:0:0.000001866 DEBUG (14): Booted
0:0:0.000001876 DEBUG (14): Radio On
0:0:0.000001999 DEBUG (15): Booted
0:0:0.000002009 DEBUG (15): Radio On
0:0:0.000002132 DEBUG (16): Booted
0:0:0.000002142 DEBUG (16): Radio On
0:0:0.000002266 DEBUG (17): Booted
0:0:0.000002276 DEBUG (17): Radio On
0:0:0.000002399 DEBUG (18): Booted
0:0:0.000002409 DEBUG (18): Radio On
0:0:0.000002532 DEBUG (19): Booted
0:0:0.000002542 DEBUG (19): Radio On
0:1:57.945314110 DEBUG (1): A Command has been Issued.
0:1:57.945314110 DEBUG (1): Command Type: Ping
0:1:57.945314110 DEBUG (1): PING EVENT
0:1:57.945314110 DEBUG (1): Hello?
0:1:57.945314110 DEBUG (1): before floodsender
0:1:57.945314110 DEBUG (1): Flooding Network: Hello, World
0:1:57.945314110 DEBUG (1): after floodsender
0:1:57.967224226 DEBUG (2): Packet Received:
0:1:57.967224226 DEBUG (2): The packet has reached its destination with the message: Hello, World
0:1:57.967224226 DEBUG (2): [Src:Dest] 1 : 2
Hello what is going on
Segmentation fault (core dumped)

Related

"Out of memory" in hibrid MPI/OpenMP for GPU acceleration

I have compiled Quantum ESPRESSO (Program PWSCF v.6.7MaX) for GPU acceleration (hibrid MPI/OpenMP) with the next options:
module load compiler/intel/2020.1
module load hpc_sdk/20.9
./configure F90=pgf90 CC=pgcc MPIF90=mpif90 --with-cuda=yes --enable-cuda-env-check=no --with-cuda-runtime=11.0 --with-cuda-cc=70 --enable-openmp BLAS_LIBS='-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core'
make -j8 pw
Apparently, the compilation ends succesfully. Then, I execute the program:
export OMP_NUM_THREADS=1
mpirun -n 2 /home/my_user/q-e-gpu-qe-gpu-6.7/bin/pw.x < silverslab32.in > silver4.out
Then, the program starts running and print out the next info:
Parallel version (MPI & OpenMP), running on 8 processor cores
Number of MPI processes: 2
Threads/MPI process: 4
...
GPU acceleration is ACTIVE
...
Estimated max dynamical RAM per process > 13.87 GB
Estimated total dynamical RAM > 27.75 GB
But after 2 minutes of execution the job ends with error:
0: ALLOCATE: 4345479360 bytes requested; status = 2(out of memory)
0: ALLOCATE: 4345482096 bytes requested; status = 2(out of memory)
--------------------------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code. Per user-direction, the job has been aborted.
--------------------------------------------------------------------------
--------------------------------------------------------------------------
mpirun detected that one or more processes exited with non-zero status, thus causing
the job to be terminated. The first process to do so was:
Process name: [[47946,1],1]
Exit code: 127
--------------------------------------------------------------------------
This node has > 180GB of available RAM. I check the Memory use with the top command:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
89681 my_user 20 0 30.1g 3.6g 2.1g R 100.0 1.9 1:39.45 pw.x
89682 my_user 20 0 29.8g 3.2g 2.0g R 100.0 1.7 1:39.30 pw.x
I noticed that the process stops when RES memory reaches 4GB. This are the caracteristics of the node:
(base) [my_user#gpu001]$ numactl --hardware
available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 28 29 30 31 32 33 34 35 36 37 38 39 40 41
node 0 size: 95313 MB
node 0 free: 41972 MB
node 1 cpus: 14 15 16 17 18 19 20 21 22 23 24 25 26 27 42 43 44 45 46 47 48 49 50 51 52 53 54 55
node 1 size: 96746 MB
node 1 free: 70751 MB
node distances:
node 0 1
0: 10 21
1: 21 10
(base) [my_user#gpu001]$ free -lm
total used free shared buff/cache available
Mem: 192059 2561 112716 260 76781 188505
Low: 192059 79342 112716
High: 0 0 0
Swap: 8191 0 8191
The version of MPI is:
mpirun (Open MPI) 3.1.5
This node is a compute node in a cluster, but no matter if I submit the job with SLURM or run it directly on the node, the error is the same.
Note that I compile it on the login node and run it on this GPU node, the difference is that on the login node it has no GPU connected.
I would really appreciate it if you could help me figure out what could be going on.
Thank you in advance!

WatchOS 6 TTS bug ? AXSpeechManager isSpeaking crash

Here is the bug report. I think it's a bug of watchOS 6 something related to apple Text to Speech service.
When i not use tts, it's go away.
Incident Identifier: 3C86B3F2-0565-464C-921C-A0ECB63237EB
CrashReporter Key: 9de6d125d2514512fa87c39b4cc898e09cf8d8cc
Hardware Model: Watch4,4
Process: LeanWatchApp Extension [367]
Path: /private/var/containers/Bundle/Application/D8EC0163-C8EA-4375-B556-3C751744EEE3/LeanWatchApp.app/PlugIns/LeanWatchApp Extension.appex/LeanWatchApp Extension
Identifier: hltek.Lean.watchkitapp.watchkitextension
Version: 4 (1.15)
Code Type: ARM (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: hltek.Lean.watchkitapp.watchkitextension [473]
Date/Time: 2019-10-08 08:45:38.1157 +0800
Launch Time: 2019-10-08 08:42:38.0000 +0800
OS Version: Watch OS 6.0.1 (17R605)
Release Type: User
Baseband Version:
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000195eb0c0
VM Region Info: 0x195eb0c0 is not in any region. Bytes after previous region: 553153 Bytes before following region: 104714048
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
Stack 194dc000-19564000 [ 544K] rw-/rwx SM=COW thread 5
---> GAP OF 0x6464000 BYTES
unused shlib __TEXT 1f9c8000-1f9ee000 [ 152K] r-x/r-x SM=COW ... this process
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [367]
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_pthread.dylib 0x1fd6a670 pthread_get_qos_class_np + 8
1 Foundation 0x20adf988 -[NSThread qualityOfService] + 80
2 Foundation 0x20aa24e8 -[NSObject+ 271592 (NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 272
3 Foundation 0x20aa43f4 -[NSObject+ 279540 (NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 116
4 libAXSpeechManager.dylib 0x437a88f0 -[AXSpeechManager isSpeaking] + 112
5 libAXSpeechManager.dylib 0x437a3c38 -[AXSpeechManager _didBeginInterruption] + 52
6 libAXSpeechManager.dylib 0x437a3fec -[AXSpeechManager _handleAudioInterruption:] + 500
7 CoreFoundation 0x200bb1d0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
8 CoreFoundation 0x200bb218 ___CFXRegistrationPost1_block_invoke + 64
9 CoreFoundation 0x200ba580 _CFXRegistrationPost1 + 368
10 CoreFoundation 0x200ba24c ___CFXNotificationPost_block_invoke + 104
11 CoreFoundation 0x20037fec -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1392
12 CoreFoundation 0x200b9bc8 _CFXNotificationPost + 1188
13 Foundation 0x20a694c0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 60
14 AVFAudio 0x2ac2048c -[AVAudioSession privateInterruptionWithInfo:] + 992
15 AVFAudio 0x2ac22c30 (anonymous namespace)::HandlePropertyListenerCallback+ 597040 (unsigned int, objc_selector*, NSObject*) + 72
16 libdispatch.dylib 0x1fb333a0 _dispatch_call_block_and_release + 24
17 libdispatch.dylib 0x1fb34730 _dispatch_client_callout + 16
18 libdispatch.dylib 0x1fb405a8 _dispatch_main_queue_callback_4CF + 992
19 CoreFoundation 0x200dbe6c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
20 CoreFoundation 0x200d6a10 __CFRunLoopRun + 740
21 CoreFoundation 0x200d6420 CFRunLoopRunSpecific + 464
22 GraphicsServices 0x236462ec GSEventRunModal + 100
23 UIKitCore 0x3ca1f784 UIApplicationMain + 1760
24 libxpc.dylib 0x1fdc4aa4 _xpc_objc_main.cold.3 + 208
25 libxpc.dylib 0x1fdb0a90 _xpc_objc_main + 212
26 libxpc.dylib 0x1fdb33e4 xpc_main + 152
27 Foundation 0x20aa663c +[NSXPCListener serviceListener] + 0
28 PlugInKit 0x298462f8 0x2982d000 + 103160
29 WatchKit 0x325c4f94 WKExtensionMain + 60
30 WatchKit 0x325c4fb8 main + 12
31 libdyld.dylib 0x1fb70a38 start + 4
It's very similar to this:
App is getting crashed on app launch in iOS 13 beta version
When make wrist down , the watch screen off ,It always crash. but my app is Workout app, it can work in background before watchOS 6.

output of kamailio shared memory

I am trying to monitor the memory usage of kamailio. The PKG memory I have arranged, though the shared memory is something else.
According to documentation you can get the shared memory like this:
kamcmd mod.stats all shm
In my case, I get the following:
Module: core
{
msg_lump_cloner(984): 1560
dns_cache_mk_bad_entry(867): 192
dns_cache_mk_rd_entry(1216): 232
build_req_buf_from_sip_req(2155): 2752
sip_msg_shm_clone(495): 822664
tcpconn_new(957): 16416728
counters_prefork_init(207): 30720
cfg_clone_str(130): 208
cfg_shmize(217): 976
init_pt(105): 4200
cfg_parse_str(906): 80
init_pt(106): 16
init_pt(111): 40
create_avp(175): 10368
register_timer(1012): 720
cfg_register_ctx(47): 128
init_tcp(4643): 8192
init_tcp(4637): 32768
init_tcp(4629): 8
init_tcp(4622): 8
init_tcp(4615): 8
init_tcp(4609): 8
init_tcp(4597): 8
init_avps(90): 8
init_avps(89): 8
init_dst_blacklist(437): 16384
init_dst_blacklist(430): 8
timer_alloc(515): 96
init_dns_cache(366): 8
init_dns_cache(358): 16384
init_dns_cache(351): 16
init_dns_cache(345): 8
init_timer(284): 8
init_timer(283): 16384
init_timer(282): 8
init_timer(281): 8
init_timer(270): 8
init_timer(238): 8
init_timer(221): 278544
init_timer(220): 8
init_timer(207): 8
cfg_child_cb_new(830): 64
sr_cfg_init(361): 8
sr_cfg_init(354): 8
sr_cfg_init(347): 8
sr_cfg_init(335): 8
sr_cfg_init(323): 24
shm_core_lock_init(153): 8
Total: 17660616
}
... [ list of modules here, snipped because not relevant I think] ...
So I guess the one I need is Total: 17660616.
However, what does this mean? Is it the total allocated memory? Available memory?
The commands you used is for seeing the used of shared memory per module.
If you want the statistics for total used and free shared memory, then use the command:
kamctl stats shmem
or:
kamcmd stats.get_statistics shmem:
The output will be like:
shmem:fragments = 179
shmem:free_size = 127471848
shmem:max_used_size = 7269016
shmem:real_used_size = 6745880
shmem:total_size = 134217728
shmem:used_size = 5106728
The free_size value is the one you have to monitor for available shared memory.

Asterisk Sipml5

I'm using Duobango SIPML5. But when call is processed this errors appears:
[Apr 17 11:01:05] WARNING[24230][C-00000014]: chan_sip.c:10842 process_sdp: Matched device setup to use SRTP, but request was not! NOTICE[24674][C-00000013]: chan_sip.c:10386 process_sdp: Received SAVPF profle in audio offer but AVPF is not enabled, enabling: audio 58823 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126 [Apr 17 10:56:26] WARNING[24674][C-00000013]: chan_sip.c:10785 process_sdp: Rejecting secure audio stream without encryption details: audio 58823 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 126 Can you help me, please? Thank you in advance!
You should set encryption=yes for the peer in sip.conf.

cursor loop and continue statement : unexpected behaviour

I might be overlooking something due to deadline stress. But this behaviour amazes me.
It looks as if the cursor caches 100 rows and the continue statement flushes the cache
and begins with the first record of a new cache fetch.
I narrowed it down to the following script:
drop table test1;
create table test1 (test1_id NUMBER);
begin
for i in 1..300
loop
insert into test1 values (i);
end loop;
end;
/
declare
cursor c_test1 is
select *
from test1;
begin
for c in c_test1
loop
if mod(c.test1_id,10) = 0
then
dbms_output.put_line(c_test1%ROWCOUNT||' '||c.test1_id||' Continue');
continue;
end if;
dbms_output.put_line(c_test1%ROWCOUNT||' '||c.test1_id||' Process');
end loop;
end;
/
1 1 Process
2 2 Process
3 3 Process
4 4 Process
5 5 Process
6 6 Process
7 7 Process
8 8 Process
9 9 Process
10 10 Continue **Where are tes1_id's 11 to 100?**
11 101 Process
12 102 Process
13 103 Process
14 104 Process
15 105 Process
16 106 Process
17 107 Process
18 108 Process
19 109 Process
20 110 Continue **Where are tes1_id's 111 to 200?**
21 201 Process
22 202 Process
23 203 Process
24 204 Process
25 205 Process
26 206 Process
27 207 Process
28 208 Process
29 209 Process
30 210 Continue **Where are tes1_id's 211 to 300?**
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
redhat release 5
2 node RAC
It's a bug: 7306422
Pawel Barut wrote:
http://pbarut.blogspot.com/2009/04/caution-for-loop-and-continue-in-oracle.html
Workaround :
SQL> ALTER SESSION SET PLSQL_OPTIMIZE_LEVEL = 1;
Regards,
Rob

Resources