Alfresco 3.4d ldap sync

While upgrading from 3.3g to 3.4d, my ldap sync wouldn’t work anymore.

I had to add in my the following line:

[sourcecode language=’bash’][/sourcecode]

While there is a similar line for authentication, it doesn’t do it for sync’ing up.

[sourcecode language=’bash’][/sourcecode]

Tomcat: Too many open files… but why?

Update: Opened bug ALF-4661. It seems fd are never released hence growing indefinitly, and reaching an NFS max on my netapp appliance (best guess at the moment).

Update 2: Turned out to be an alfresco bug. See

Each morning, my tomcat server is out, returning 500 errors because of this:
[sourcecode language=’bash’]
SEVERE: Socket accept failed
org.apache.tomcat.jni.Error: Too many open files
at org.apache.tomcat.jni.Socket.accept(Native Method)

So, I initially had a ulimit -n of 1024. No problem, changed my shell and limits.conf to have 4096 and restarted the process. The next day, same error. So increased it to 32768. Same results.

So I ran a couple cron job to see what was happening during the night:

[sourcecode language=’plain’]
# Monitor openfiles
* * * * * /usr/sbin/lsof -n -u root|egrep ‘java|alfresco|tomc’ | wc -l >> /tmp/lsof_mon.out
* * * * * cat /proc/sys/fs/file-nr >> /tmp/file-nr.out

Apparently, the results are OK, despite the continuing errors. The “lsof” cron job never get any higer than 1320, and the monitor on file-nr didn’t get above “2550 0 767274”.

Yes, I made sure the process was launched with the new parameter. Even after restarting the system, ulimit -n returns the correct amount of file descriptors. Even running “lsof” by itself doesn’t return more than 3000 lines.

For info, server is running CentOS 2.6.18-194.3.1.el5 #1 SMP x86_64. libtcnative is at version 1.20. Process running as root.

Any idea anyone? Thanks.

Alfresco: Filesystem count of file types stored

find ./contentstore -type f -exec file -inb {} ;| sort |uniq -c|sort -nr

48724 application/pdf
2863 application/postscript
1909 text/plain; charset=us-ascii
1830 application/octet-stream
340 image/png
116 application/x-empty
104 text/x-c++; charset=us-ascii
93 application/msword application/msword
54 application/x-zip
40 image/jpeg
30 application/msword
29 text/x-c; charset=us-ascii
27 text/html
15 application/x-shockwave-flash
11 very short file (no magic)
9 text/PGP armored data message
8 text/plain; charset=utf-8
2 text/plain; charset=iso-8859-1
2 application/x-dosexec
1 video/x-msvideo
1 text/x-c++; charset=iso-8859-1

Counting documents in Alfresco’s database

Here is a rough and raw SQL procedure to count the documents in Alfresco 3.2, per type.
Of course, change your database name and type correct document types.

[sourcecode language=’sql’]
create procedure alfresco_doc_report ()
declare alfdoc_type varchar(50);
declare loopdone int default 0;
declare c1 cursor for select local_name from alf_qname where local_name in
(‘doctype1’, ‘doctype2’, ‘doctype3’);
declare continue handler for NOT FOUND set loopdone = 1;

open c1;

fetch c1 into alfdoc_type;

while not loopdone do
SELECT alfdoc_type, count(*) FROM alfresco_rm.alf_node
where store_id = (select id from alf_store where protocol = ‘workspace’ and identifier = ‘SpacesStore’)
AND type_qname_id = (select id from alf_qname where local_name = alfdoc_type);

fetch c1 into alfdoc_type;
end while;

close c1;


Edit: Removed the line ” inner join alfresco_rm.alf_node_properties b on”