Anonymous | Login | 2024-11-22 23:20 EST |
Main | My View | View Issues | Change Log | Roadmap |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||
0001152 | PacketFence | upstream | public | 2011-01-13 12:43 | 2011-01-18 09:54 | |||
Reporter | obilodeau | |||||||
Assigned To | obilodeau | |||||||
Priority | normal | Severity | minor | Reproducibility | random | |||
Status | resolved | Resolution | not fixable | |||||
Platform | OS | OS Version | ||||||
Product Version | ||||||||
Target Version | Fixed in Version | |||||||
Summary | 0001152: FreeRADIUS hangs in our perl module with: Modification of a read-only value .../DBI.pm line 563 | |||||||
Description | Error: rlm_perl: perl_embed:: module = /etc/raddb/rlm_perl_packetfence.pl , func = post_auth exit status= Modification of a read-only value attempted at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/DBI.pm line 563. Launching db connection in FreeRADIUS' CLONE {...} then re-connecting only if necessary should mitigate the issue. Here's a patch for those interested: --- pf/addons/802.1X/rlm_perl_packetfence.pl c967f44b9c3e832b4c2189e5792b47c1006872cd +++ pf/addons/802.1X/rlm_perl_packetfence.pl 4c5b8f74db3f0770ba542f020d98a1e74ffa1371 @@ -37,6 +37,7 @@ use vars qw(%RAD_REQUEST %RAD_REPLY %RAD use vars qw(%RAD_REQUEST %RAD_REPLY %RAD_CHECK); #use Data::Dumper; +our $mysql_connection; # This is hash wich hold original request from radius #my %RAD_REQUEST; # In this hash you add values that will be returned to NAS. @@ -221,6 +222,22 @@ sub log_request_attributes { } } +sub CLONE { + db_connect(); +} + +sub db_connect { + + $mysql_connection = DBI->connect("dbi:mysql:dbname=".DB_NAME.";host=".DB_HOSTNAME, + DB_USER, DB_PASS, {PrintError => 0}); + + if (!defined($mysql_connection)) { + openlog("rlm_perl_packetfence", "perror,pid","user"); + syslog("info", "Can't connect to the database."); + closelog(); + } +} + # Here is the decision process: # # registered, guest, secure => disconnect (-1) @@ -250,14 +267,16 @@ sub getVlan { openlog("rlm_perl_packetfence", "perror,pid","user"); syslog("info", "getVlan called with switch_ip $switch_ip, mac $mac, is_eap_request $is_eap_request"); - - # create database connection - my $mysql_connection = DBI->connect("dbi:mysql:dbname=".DB_NAME.";host=".DB_HOSTNAME, - DB_USER, DB_PASS, {PrintError => 0}); + + if (!defined($mysql_connection) || !$mysql_connection->ping() ) { + syslog("info", "Database connection seems down.. Reconnecting..."); + db_connect(); - if (!defined($mysql_connection)) { - syslog("info", "Can't connect to the database."); - return undef; + if (!defined($mysql_connection) || !$mysql_connection->ping() ) { + syslog("info", "Database still down... Bailing out for this request."); + closelog(); + return; + } } # check if mac exists already in database @@ -402,7 +421,6 @@ sub getVlan { # return the correct VLAN, close resources syslog("info", "returning VLAN $correctVlan for $mac"); closelog(); - $mysql_connection->disconnect(); return $correctVlan; } | |||||||
Tags | No tags attached. | |||||||
fixed in git revision | ||||||||
fixed in mtn revision | ||||||||
Attached Files | ||||||||
Notes | |
(0001809) obilodeau (reporter) 2011-01-13 12:44 |
Our code is no longer doing database access so this issue will not occur with anything > 2.0. Issue was filed only for reference. |
(0001812) obilodeau (reporter) 2011-01-18 09:54 |
by the way the CLONE { ... } above suggestion did not work. Look into https://github.com/alandekok/freeradius-server/blob/master/doc/bugs [^] for more in-depth FreeRADIUS troubleshooting. |
Issue History | |||
Date Modified | Username | Field | Change |
2011-01-13 12:43 | obilodeau | New Issue | |
2011-01-13 12:43 | obilodeau | Status | new => assigned |
2011-01-13 12:43 | obilodeau | Assigned To | => obilodeau |
2011-01-13 12:44 | obilodeau | Note Added: 0001809 | |
2011-01-13 12:44 | obilodeau | Status | assigned => resolved |
2011-01-13 12:44 | obilodeau | Resolution | open => not fixable |
2011-01-18 09:54 | obilodeau | Note Added: 0001812 |
Copyright © 2000 - 2012 MantisBT Group |