[jboss-jira] [JBoss JIRA] (DROOLS-610) drools-worker-2 thread blocked and the main program blocks
Nathalie ravenel (JIRA)
issues at jboss.org
Thu Sep 25 02:52:02 EDT 2014
[ https://issues.jboss.org/browse/DROOLS-610?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nathalie ravenel updated DROOLS-610:
------------------------------------
Attachment: image001.jpg
Dear Mario,
It is possible we don’t use correctly drools. We have a program what receives some events and updates the “working memory”. Inside the function modifier-element (to update the facthandle), we update the facthandle and after we fireAllRules. Please find below the corresponding java code.
We don’t have to fireAllRules ?
Nathalie
public void modifier_element(String nom_slot, String valeur) {
String tmp;
// on passe le nom en minuscule
nom_slot = nom_slot.toLowerCase();
//
if(debug)
//executer_commande("echo \""+nom_slot+": "+valeur+"\" >> ../debug/console.txt");
//System.out.println("Modifier element (str/str) : "+nom_slot+" valeur "+valeur);
try {
// on parcourt la liste de noms
for (String nom : listeDesNoms) {
// si le nom du slot contient le nom (ex : data_srv_1_choc contient data_srv_1)
//if(debug & nom_slot.contains("courant_commande")) System.out.println("Nom slot "+nom_slot+" valeurs:" +valeur+"\n");
if (nom_slot.contains(nom)) {
// be carefull element serveur_choc ... not dealed by this command
// find the element and the string attribute
tmpO = listeElements.get(nom);
tmp=tmpO.getString(nom_slot);
/*if (nom_slot.contains("_choc")) {
System.out.println("Element (str/str) "+nom_slot+" (initial/update) :"+tmp+" /"+valeur+"\n");
}*/
// si la valeur du slot est differente de l'ancienne
//if(debug) System.out.println("Nom associe str/str "+nom+" slot: "+nom_slot+" valeurs: "+tmp+ "/"+valeur+"\n");
if ( tmp == null || !tmp.equals(valeur)){
//if (!tmpO.getString(nom_slot).equals(valeur) ) {
// on recupere le factHandle relatif a l'objet
try{
tmpFH = listeFactHandle.get(tmpO.getNom());
}
catch(NullPointerException e){
System.err.println("erreur de recuperation dans le fact handle...");
}
// on modifie son attribut
tmpO.modifierAttributString(nom_slot, valeur);
// update memory
//this.session.update(listeFactHandle.get("myBool"), myBool );
this.session.update(tmpFH, tmpO);
this.session.fireAllRules();
//if(debug) System.out.println("Modifié en memoire (str) "+tmpO.getNom()+" slot: "+nom_slot+" valeur: "+valeur);
//if((debug)& (nom_slot.contains("courant"))) System.out.println("Fin modif (str) objet "+tmpO.getNom()+" slot: "+nom_slot+" valeur: "+valeur);
}
// pas propre mais gain de temps
break;
}
}
// si le nom est pas trouve on l'imprime a l'ecran
} catch (NullPointerException e) {
//if(!nom_slot.contains("_phase") & !nom_slot.contains("_seuil") & !nom_slot.contains("_color") & !nom_slot.contains("_left") & !nom_slot.contains("_right") & !nom_slot.contains("_middle")) {
if(debug) System.out.println("Objet non reference dans les slots (str): " + nom_slot+ " valeur "+valeur);
//}
}
// RAZ de elements temporaires
tmpO = null;
tmpFH = null;
}
De : Mario Fusco (JIRA) [mailto:issues at jboss.org]
Envoyé : mercredi 24 septembre 2014 19:56
À : RAVENEL Nathalie 161957
Objet : [JBoss JIRA] (DROOLS-610) drools-worker-2 thread blocked and the main program blocks
[Image supprimée par l'expéditeur.]
Mario Fusco<https://issues.jboss.org/secure/ViewProfile.jspa?name=mfusco> commented on [Bug] DROOLS-610<https://issues.jboss.org/browse/DROOLS-610>
Re: drools-worker-2 thread blocked and the main program blocks<https://issues.jboss.org/browse/DROOLS-610>
Nathalie,
for what I can see from the stack you attached, the deadlock is caused by the fact that you're misusing drools. In particular drools-worker-2.PNG shows that you're invoking a fireAllRules inside the execution of a drools consequence. For what I know this doesn't make any sense and I cannot see a valid reason for doing this, even because if a consequence is firing it means that you're already inside a fireAllRules.
Please let me know if you have a use case that requires to do this, so we could discuss it. Otherwise I'll close this ticket as invalid.
Cheers,
Mario
[Add Comment]<https://issues.jboss.org/browse/DROOLS-610#add-comment>
Add Comment<https://issues.jboss.org/browse/DROOLS-610#add-comment>
This message was sent by Atlassian JIRA (v6.3.1#6329-sha1:7df76f1)
[Atlassian logo]
> drools-worker-2 thread blocked and the main program blocks
> ----------------------------------------------------------
>
> Key: DROOLS-610
> URL: https://issues.jboss.org/browse/DROOLS-610
> Project: Drools
> Issue Type: Bug
> Affects Versions: 6.1.0.Final
> Environment: linux
> Reporter: Nathalie ravenel
> Assignee: Mario Fusco
> Attachments: blocked.PNG, drools-worker-2.PNG, image001.jpg, main thread.PNG, pool-1-thread1.PNG
>
>
> Running our program, we got some deadlock on one thread (drools-worker-2). We investigated the problem using java memory control. The thread is blocked and the program also. The stack traces was registered for the different threads. The last trace for the thread was : org.drools.core.common.SynchronizedLeftTuplesSets.takeAll.
> There are 1111 Blocked count on one DeadLock on the thread.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
More information about the jboss-jira
mailing list