using the perl debugger I found a little bit about the problem. The output I received seems to be possibly from the thread:
Attempt to free unreferenced scalar: SV 0x43314ac, Perl interpreter: 0x41083fc a
t GRRUVI-v0.45.pl line 133.
at GRRUVI-v0.45.pl line 133
Attempt to free unreferenced scalar: SV 0x5f53f6c, Perl interpreter: 0x4c9c85c a
t GRRUVI-v0.45.pl line 134.
at GRRUVI-v0.45.pl line 134
GLib-GObject-CRITICAL **: g_object_steal_qdata: assertion `G_IS_OBJECT (object)'
failed during global destruction.
at GRRUVI-v0.45.pl line 0
eval {...} called at GRRUVI-v0.45.pl line 0
GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' faile
d during global destruction.
at GRRUVI-v0.45.pl line 0
and refers to the code lines:
#################################################
#Threads
my $thread_gps = threads->new( \&gps);
my $thread_sftp = threads->new( \&sftp);
#################################################
though the output is a little strange with it referring to line zero of the program. The threads are stopped by the join command. I wonder if the threads I have are being exited incorrectly? I'm not sure what this attempt to free unreferenced scalar is?!
####################Threads####################
#-------------------GPS-------------------
sub gps {
my $gps_device;
while (1) {
goto END if $die == 1;
if ($gps_start == 1) {
$gps_device = GPS::NMEA->new(Port => $gps, Baud => 4800);
for (;;) {
#stops the warnings in the GPS device module
local $^W = 0;
($ns,$lat,$ew,$lon) = $gps_device->get_position;
goto END if $die == 1;
last if $gps_start == 0;
sleep 3;
}
undef $gps_device;
} else {sleep 4}
}
END:
}
#-------------------SFTP-------------------
sub sftp{
$|++;
while(1){
if ( $die == 1 ){ goto END };
if ( $sftp_start == 1 ) {
my $seconds = 120;
my %args = (host=>$server, user=>$username, timeout=>$seco
+nds);
my $sftp = Net::SFTP::Foreign->new(%args);
#$error = 1 if $sftp->error;
for (;;) {
if (defined $ns){
#The GPS file Functions
my $gps_loc = $sftp->open( "$gps_remote/$gps_file"
+ , SSH2_FXF_CREAT|SSH2_FXF_WRITE) or $sftp->error;
my $new_lat;
my $new_lon;
#adjust the gps position into decimal
if ($ns eq 'S'){
$new_lat = "-$lat";
}
else {
$new_lat = $lat;
}
if ($ew eq 'W'){
$new_lon = "-$lon";
}
else {
$new_lon = $lon;
}
$sftp->write( $gps_loc, "$nick $new_lat $new_lon")
+;
$sftp->close( $gps_loc);
}
#VC Base
if ($job == 2) {
#Upload the uasposition file
$sftp->put( $uasposition_local, $uasposition_remot
+e);
#update the counter
$count_uasposition = $count_uasposition + 0.05;
#Create the attribute file
my $stat_final = Net::SFTP::Foreign::Attributes->n
+ew;
#open the files on the server; flagged for writing
+ and creating
my $waytemp = $sftp->open( $waytemp_remote) or $sf
+tp->error;
my $wayfinal = $sftp->open( $wayfinal_remote, SSH2
+_FXF_CREAT, $stat_final) or $sftp->error;
#Read the stats of the files and check which is ne
+wer
my $stat_temp = $sftp->fstat($waytemp);
$stat_final = $sftp->fstat($wayfinal);
#check to see if temp is newer than final
if (( $stat_final->mtime) < ($stat_temp->mtime)) {
#Turn verification window on
$verify = 1 if $verify == 0;
if ( $verify == 2) {
#read the lines in then write to the wayfi
+nal file if it is newer then the waytemp file
my $print = $sftp->readline( $waytemp);
my $wayfinal = $sftp->open( $wayfinal_remo
+te, SSH2_FXF_TRUNC|SSH2_FXF_WRITE) or $sftp->error;
#write to the file and add to the counter
+if it does write
$sftp->write( $wayfinal, $print);
$count_waypoint = $count_waypoint + 0.05;
$verify = 0;
}
if ( $verify == 3) {
#get time and print it to the final file
my $time = time;
$stat_final->set_amtime( $time, $time);
$sftp->fsetstat( $wayfinal, $stat_final);
$count_waypoint = $count_waypoint + 0.05;
$verify = 0;
}
#close the files on the server
$sftp->close( $waytemp);
$sftp->close( $wayfinal);
}
}
#Met Base
if ($job == 3){
#Open the waytemp file on the server; for write on
+ly
if ( $verify == 4) {
my $waytemp = $sftp->open( $waytemp_remote, SS
+H2_FXF_TRUNC|SSH2_FXF_WRITE) or $sftp->error;
#Write the waypoints to the waytemp file
$sftp->write( $waytemp, $coords);
$sftp->close( $waytemp);
$count_waypoint = $count_waypoint + 0.05;
$verify = 0;
}
}
sleep 1;
}
if($sftp_start == 0){ last};
if($die == 1){ goto END };
#undef $sftp;
}else { sleep 1 }
}
END:
}
#################################################
|