Migrating to threaded rlm_perl
Alexander Clouter
alex at digriz.org.uk
Mon Jun 20 15:28:38 CEST 2011
Energ <ponch at ponch.ru> wrote:
>
> Please, help me with understanding of concept how to rewrite my perl
> module to work with threaded perl.
>
> Now it looks like this:
>
> [snipped thread unsafe code]
>
> While non-threaded perl it works as expected. But threading breaks creation
> of Shared memory (cuz it want to do it for every thread).
> I also wonder, do i need to post &fetch_url inside CLONE sub or not.
> So, the main question: is there any part of code in rlm, that suppose to run
> only once ( create shared memory in my situation) or how to correctly solve
> problem with IPC within the confines of freeradius.
>
You should have a read of:
http://perldoc.perl.org/perlmod.html#BEGIN,-UNITCHECK,-CHECK,-INIT-and-END
I would recommend you do not use IPC::Shareable and instead look to use
BerkeleyDB instead with locks...also means whatever in in your hash is
remembered across FreeRADIUS restarts.
Cheers
[1] http://search.cpan.org/dist/BerkeleyDB/BerkeleyDB.pod
--
Alexander Clouter
.sigmonster says: BOFH excuse #192:
runaway cat on system.
More information about the Freeradius-Users
mailing list