RichTextEditor Bug
The issue i found with the RTE is when using the HTMLText
property and saving the contents somewhere, the font tag has the
size property set to the value you choose in the font size drop
down. This is Ilegal HTML syntax, and when displaying in a regular
HTML page, the text is extremly large. The issue is that HTML does
not recognize any number here higher than a 6, the lowest the
editer will allow you to choose is an 8.
This component should be updated!
instead of using the font "size=N" attribute it should use a
"style='font-size:N"
that way the content of the HTMLText property when saved back
to a source, can then be viewed in a standard html page.
Or change the drop down font size list to show valid font
size values and make the editor display them properly.
Is there an update to address this?
if not, can someone Please Fix it?
TIA
Tim
Hi Peter,
Thank you for the reply and helpful insight.
I followed your advise and submited a bug report.
Robert Vollmar answered the bug request and sent me the
following:
quote:
"The absolute point sizes used by the Flash Player are not
the same as the relative font sizes used in standard HTML. In a web
browser, <FONT SIZE=2> indicates a font size that is one
point smaller than the browser's default font size. The Flash
Player would interpret the tag literally as a font that is 2 pixels
in height."
It's probably a good idea for us to add this note to the Flex
documentation. I will file it as such.
For my purposes we are using flex as a data manager UI. there
are several DB Fields that hold Ntext data types that are edited
via an RTE. I have been saving the data directly without
modification because if you try and fix the font size issue, when
you reload the data it is not viewable by the RTE. So i came up
with a CFC format function to fix the issue on the fly when viewing
it in the browser window.
This function is probably not the best approach but it works.
It will find all the font size attribs and values and add in a
style tag with the font size value as the style value. This needs
to be done because if you have several font tags all with different
values you can not just replace them all with the first value
found.
Anyway I hope this article helps someone else besides me.
Best Regards
Tim
On the HTML page to display the content:
#formatRTEHTML(mytext)#
-- CFC Function --
<cffunction access="public" name="formatRTEHTML"
returntype="string" output="false">
<cfargument name="rte_text" type="string"
required="yes">
<cfset var new ="">
<!---
Format function.
takes the RichTextEditor.HTMLText contents, and formats it
for viewing in HTML
--->
<cfsilent>
<cfloop list="#rte_text#" delimiters=">"
index="L"><cfset r ="">
<cfset x = FindNoCase("SIZE=",L)>
<cfif x gt 0><cfset i = 0>
<cfloop list="#L#" delimiters=" " index="LL"><cfset
i = i + 1>
<cfif LL contains "size=">
<cfset fsv = ListLast(LL,chr(34))>
<cfset r = " style='font-size:#fsv#px' ">
<cfset r = Replace(L," "," #TRIM(r)# ")>
</cfif>
</cfloop>
<cfset r = r & ">">
<cfelse>
<cfset r = L>
</cfif>
<cfset new = new & r>
</cfloop>
</cfsilent>
<cfreturn new>
</cffunction>
Similar Messages
-
Bug: RichTextEditor "Initialize" not classed as event handler
I'm trying to load the RichTextEditor control in a popup window. Here's my code:
var rte:RichTextEditor = new RichTextEditor();
rte.width = 600;
rte.height = 500;
rte.title = 'Edit Text';
I need to add the initialize event handler so I can add a button to the toolbar (as per the example on the Adobe website).
However, when I type:
rte.initialize = "addSaveButton()";
Flash Builder says this is invalid as "initialize" is actually a function and doesn't accept any parameters.
Compare this with:
<mx:RichTextEditor initialize="addSaveButton()"/>
Flash Builder recongises "initialize" as an event handler and therefore accepts the addSaveButton() function.
Can anyone else confirm whether this is a bug with the SDK or not? I can simply add the button outside of the RTE for now, but then I'd have to wrap the RTE in a separate panel to accomodate the button, which isn't ideal.
Thanks in advance.Hi,
this is how to add the event listener
rte.addEventListener(FlexEvent.INITIALIZE,addSaveButton);
David. -
Non SGML character in RichTextEditor drops the page - bug?
Hello,
I have a reproducible error behavior which drops ADF page.
There's a RichTextEditor on my page having data from DB CLOB. Usually it works fine but when it encouters a certain CLOB record, the page just refreshes and nothing works.
The CLOB content represents HTML text and looks fine. I uploaded it to W3C HTML Validator and found out that there are couple of non SGML characters in the text (Line 27, Column 297; Line 27, Column 328).
I have no opportunity to fix this text in ADF application and have to use some DB tool to delete those chars.
I guess, this is a bug and would like to know if there's any option to process this error and save ADF page living.
I've also saved the text if someone need to reproduce the case: https://www.dropbox.com/s/lbp83q5wzcbfca0/nonSGMLchar.txt
Thanks.
JDev 11.1.2.3
hellow?
Edited by: ILya Cyclone on Mar 27, 2013 11:43 AMHello John,
When I'm selecting a bad record the Chrome browser just refreshes the page and I'm on the previuosly selected good row again.
I can't see the page source on bad record.
I've checked another browsers: Firefox and IE behave the same way.
Edited by: ILya Cyclone on Mar 27, 2013 2:55 PM -
RichTextEditor HTML Bug????
Is this a bug or am I doing something wrong. I want to set
the html text value of a RichTextEditor like this:
planText.htmlText='My text goes here. <br>
<br> More text goes here.';
When I do this, it displays in the RichTextEditor as this:
My text goes here. <br> <br> More text goes here.
I have some text set in the RichTextEditor control initially,
and that displays fine, but if I need to change the text to
something else, I have the problem above.
If I can't do it this way, can I set it back to the default
text from the control?If the script that's making this assignment is in a CDATA
section, you should use the literal < and >, not < and
>, since they're not interpreted in a CDATA section.
Tim -
Hello,
My flex website at
http://www.theplaygrounds.co.uk/The_Playground.swf
throws the below error when I click on Contact or B/I/U on the Rich
Text Editor.
ReferenceError: Error #1069: Property string not found on
mx.controls.RichTextEditor and there is no default value.
at
mx.validators::Validator/mx.validators:Validator::getValueFromSource()
at mx.validators::Validator/validate()
at mx.validators::Validator/::triggerHandler()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.controls::RichTextEditor/__textArea_valueCommit()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at mx.controls::TextArea/set text()
at
mx.controls::RichTextEditor/mx.controls:RichTextEditor::commitProperties()
at mx.core::UIComponent/validateProperties()
at mx.managers::LayoutManager/::validateProperties()
at mx.managers::LayoutManager/::doPhasedInstantiation()
at Function/
http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/::callLaterDispatcher2()
at mx.core::UIComponent/::callLaterDispatcher()
What is actually the bug here?
Also, on the contact page, I need to be able to scroll down
for the submit button. How could I implement this? I've tried
everything.
ThanksHi,
I have this code for validation:
<mx:StringValidator
id="nameValidator"
source="{userName}"
property="string"
minLength="2"
/>
<mx:StringValidator
id="nameValidator1"
source="{userComment}"
property="string"
minLength="2"
/>
<mx:StringValidator
id="nameValidator2"
source="{userEmail}"
property="string"
minLength="2"
/>
This acts on the contact form's forms, as these are the only
textboxes in the web app.♠
The contact form code:
</mx:Canvas>
<mx:Canvas label="Contact" width="100%" height="100%"
verticalScrollPolicy="off" backgroundAlpha="0.7">
<mx:Panel
title="Feedback"
left="10" top="10" right="10" bottom="10"
layout="absolute"
verticalScrollPolicy="on">
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
import mx.controls.Alert;
private const NL:String = "\r";
private function submitButtonClickHandler
(event:MouseEvent):void
var userDetails:String = "You submitted the following
details:" + NL + NL;
userDetails += "Name: " + userName.text + NL;
userDetails += "Email: " + userEmail.text + NL;
userDetails += "Hide email? " + (hideEmail.selected ? "Yes"
: "No") + NL + NL;
userDetails += "Comment:" + NL + NL + userComment.text;
Alert.show (userDetails);
private function emailButtonClickHandler
(event:MouseEvent):void
var msg:String = "You can use the navigateToURL() method to
open a URL"
msg += " using a call similar to the following:\r\r";
msg += "navigateToURL (new URLRequest
('mailto:[email protected]'));";
Alert.show (msg);
]]>
</mx:Script>
<mx:Panel
title="Leave a comment"
layout="absolute"
width="523" height="573" x="10" y="10"
backgroundColor="#E9ECE7" verticalScrollPolicy="on">
<mx:Label text="Name:" x="10" y="12"/>
<mx:TextInput id="userName" y="10" right="10"
left="90"/>
<mx:Label text="Email:" x="10" y="43"/>
<mx:TextInput id="userEmail" y="41" right="10"
left="90"/>
<mx:Label text="Comment:" x="10" y="99"/>
<mx:CheckBox
id="hideEmail"
y="76" left="90"
label="Hide my email address"
selected="true"
/>
<mx:RichTextEditor x="90" y="126" title="Leave a comment"
id="userComment" text="Leave A Comment" enabled="true"
verticalScrollPolicy="auto">
</mx:RichTextEditor>
<mx:ControlBar x="120" y="258"
horizontalAlign="center">
</mx:ControlBar>
<mx:Button
id="submitButton" label="Submit"
click="submitButtonClickHandler(event);"
x="355" y="79" fontSize="10" fontWeight="bold"
mouseDownEffect="{shrink}" mouseUpEffect="{revert}"
fillAlphas="[0.0, 0.0, 0.0, 0.0]">
</mx:Button>
</mx:Panel>
<mx:Script>
<![CDATA[
import flash.events.MouseEvent;
import mx.controls.Alert;
private function submitButtonClickHandler1
(event:MouseEvent):void
var userDetails:String = "You submitted the following
details:" + NL + NL;
userDetails += "Name: " + userName.text + NL;
userDetails += "Email: " + userEmail.text + NL;
userDetails += "Hide email? " + (hideEmail.selected ? "Yes"
: "No") + NL + NL;
userDetails += "Comment:" + NL + NL + userComment.text;
Alert.show (userDetails);
]]>
</mx:Script>
Apologies if this is a basic bug, as I am new to the Flex
platform.
Thanks for your help♠♠ -
The height of mx:RichTextEditor in VDividedBox cannot be reduced to less than 200.
I'm using <mx:VDividedBox >, in which there are a mx:RichTextEditor and mx:Image, as in the code below.
When I dragged the divider of the VDividedBox to resize the heights of the Image and RichTextEditor, I found that the height of the
RichTextEditor cannot be reduced to less than 200. Is this a bug?
I replaced RichTextEditor with TextArea, then divider of VDividedBox works fine. I use Flash Builder 4.5. Please try the following code, and
post you result here. Let's help Adobe to make Flex better.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script><![CDATA[
import mx.controls.Alert;
[Bindable] public var imageSrc:String = "http://cseligman.com/text/sky/perigeeapogee.jpg";
private function showHeight():void {
Alert.show(this.rte.height.toString());
]]></fx:Script>
<mx:VDividedBox width="100%" height="100%" >
<mx:Image id="image_edit" source="{this.imageSrc}" scaleContent="true"
horizontalAlign="center" verticalAlign="bottom" width="100%" height="100%"
/>
<mx:RichTextEditor id="rte"
width="100%"
text="The Moon.... Click me to show my height." click="showHeight()"/>
</mx:VDividedBox>
</s:Application>try setting minHeight of the RTE to 0
-
Af:richTextEditor can not work fine in the popup dialog.
Hi all:
I want to use af:richTextEditor in a pop up dialog, but it can not be used correctly. The code is like below:
<af:popup id="***">
<af:dialog >
<af:richTextEditor contentStyle="width:100%" value="this is a test" inlineStyle="width:100%" binding="#{backing_myBackingBean.richTextEditor1}"
id="richTextEditor1"/>
</af:dialog>
<af:popup>
The value "this is a test" can not be shown in the editor and I can not write/edit in this rich text editor.
Anyone has some experience on using these components? Please help me.
Thanks
HartHi Frank,
Below is my test code, the text editor does not work fine actually. Can you help me to find where I was wrong using this code OR is is a bug to use richtexteditor in popup dialog?
<?xml version='1.0' encoding='GBK'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=GBK"/>
<f:view>
<af:document>
<af:form>
<af:outputText value="This is test page"/>
<af:commandButton text="PopupRichTextEditor">
<af:showPopupBehavior popupId="test">
</af:showPopupBehavior>
</af:commandButton>
<af:popup id="test">
<af:dialog modal="true">
<af:richTextEditor value="this is for test">
</af:richTextEditor>
</af:dialog>
</af:popup>
</af:form>
</af:document>
</f:view>
</jsp:root>
Thanks in advance.
Hart
Message was edited by:
harth
Message was edited by:
harth -
Deep linking with richtexteditor
Hi,
I try to do a notification / messaging system for an internal flash application and want ot do some deeplinking to control modules with html fragments. My imagination was to put some parts of the messages into url with given html fragments and use that to contorl the modules. Is there a way to do that? Everything I was trying the richtexteditor made reload the site or poped up a new blank window. Is the Richtexteditor the right component for that? I'm open for every kind of solution for flex 3
thanks in advance
r. SandorHello François,
As adviced, I have posted this feature request to your jira:
http://bugs.adobe.com/jira/browse/CGM-94
For the moment, only John Cunliffe from this post:
http://forums.adobe.com/thread/872180
... is capable of providing a working patch.
Please keep me posted!
Thank you,
masu -
Revision: 4308
Author: [email protected]
Date: 2008-12-15 12:25:20 -0800 (Mon, 15 Dec 2008)
Log Message:
Now that ASdoc processes MXML files, add comments to RichTextEditor.mxml, DefaultListEffect.mxml, and DefaultTileListEffect.mxml files.
QE Notes: None
Doc Notes: None
Bugs: -
Modified Paths:
flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/RichTextEditor.mxml
flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/DefaultListEffect.mxml
flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/DefaultTileListEffect.mxmlI'm also having this problem. I'm using Flash Builder 4.6, AIR 3.4 and I've made a DLL (e.g. ExtensionDll.dll) which needs to call functions in another DLL (e.g. DllUsedByExtensionDll.dll) . I've made sure my ANE is working with the ExtensionDll.dll already, so there are no issues with my actionscript code or my ANE packaging or my DLL compilation. However, once I start calling functions from the other DLL, it starts throwing me Error #3500. Even if I call this function (e.g. abc()) in ExtensionDll.dll, but I never actually use the function from actionscript, and I call another function (e.g. def()) from actionscript, the Error #3500 still appears, so it does not seem to depened on the whether the code is used or not.
It's similar to this problem.
http://stackoverflow.com/questions/9823504/how-to-use-external-dll-in-air-native-extension
Does anyone have a solution or at least a way to debug this? -
Problem winth drag and selection on textfields (Possible BUG?)
Hello
I've been trying to eneble draging of images and selections on RichTextEditor to make them more interactive. I've been successfull at doing this and it wasn´t that hard to make once you learn the right functions on textfields. But, my current problem is that when I start a drag operation from a text field and then I make the drop on the same textField some mouse events seem not to be reaching the selection control of the textfield.
What happens is that once the drag operation is over, the textfield behaves as if the mouse is still pressed, marking a text selection. This behavior tends to finish once you click the mouse.
I was wondering if this is a bug on the TextField or if I have to have some extra considerations when draging on a text field.
Thanks.
SebastianOK it seems that it's actually a bug, but I was able to narrow it down a bit.
When you change the state of the textfield from selectable = true to selectable = false while a selection n the textfield is been made, then when you set selectable back to true, the textfield continue to make a selection even though the mouse is no longer down. This is more likely a problem with the textField form flash than a problem with flex. -
Adding additional fonts to RichTextEditor
Hi,
i'm quite new to flex and trying to customize a
richtexteditor element. now i'd like to add more fonts to the
richtexteditor, is this possible and if yes how?
at the moment i embedded the font, but how can i import it to
the rte?
quote:
[Embed(source='BOD_R.TTF', fontName='Bodoni MT',
mimeType='application/x-font', flashType='true')] private var
myFont:Class;I can't get this to work either. This surprisingly, seems to
be a huge hole in Flex. The RTE can be assigned 1 embedded font,
through the RTE's fontfamily attribute. But, if you utilize the
fontfamilyarray, your embedded fonts, if they are non-system fonts,
are basically ignored. I've search high and low, and noboday has a
fix for this. I saw a posting on the flex bug's web site, but
someone said it was supposed to act this way... Which really throws
me for a loop, so basically its supposed to be broken then. Below
is a reference to what I've been able to do. I think I'm pretty
close, but of course nobody actually knows how to get multiple
(non-system) fonts to work in the RTE.
<mx:Style>
@font-face {
src:url("AABIGFICTION.swf");
fontFamily: "AABIGFICTION";
@font-face {
src:url("Baskerville_Old_Face.swf");
fontFamily: "Baskerville_Old_Face";
</mx:Style>
<mx:Script>
<![CDATA[
private function returnHandler():void {
RTE.fontFamilyArray = ["AABIGFICTION",
"Baskerville_Old_Face"];
]]>
</mx:Script>
<mx:RichTextEditor id="RTE" title="Title" width="440"
height="368" creationComplete="returnHandler();">
*NOTE*
*IF you assign the fontFamily within the RTE to 1 of the
embedded non-system fonts, it will render the font.
*Below AAGBIGFICTION will show, but you will not be able to
use any other font.
<mx:RichTextEditor id="RTE" title="Title" width="440"
fontFamily="AABIGFICTION" height="368"
creationComplete="returnHandler();"> -
Index with "or" clause (BUG still exists?)
The change log for 2.3.10 mentions "Fixed a bug that caused incorrect query plans to be generated for predicates that used the "or" operator in conjunction with indexes [#15328]."
But looks like the Bug still exists.
I am listing the steps to-repro. Let me know if i have missed something (or if the bug needs to be fixed)
DATA
dbxml> openContainer test.dbxml
dbxml> getDocuments
2 documents found
dbxml> print
<node><value>a</value></node>
<node><value>b</value></node>
INDEX (just one string equality index on node "value")
dbxml> listIndexes
Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
Index: node-element-equality-string for node {}:value
2 indexes found.
QUERY
setVerbose 2 2
preload test.dbxml
query 'let $temp := fn:compare("test", "test") = 0
let $results := for $i in collection("test.dbxml")
where ($temp or $i/node[value = ("a")])
return $i
return <out>{$temp}{$results}</out>'
When $temp is true i expected the result set to contain both the records, but that was not the case with the index. It works well when there is no index!
Result WITH INDEX
dbxml> print
<out>true<node><value>a</value></node></out>
Result WITHOUT INDEX
dbxml> print
<out>true<node><value>a</value></node><node><value>b</value></node></out>Hi Vijay,
This is a completely different bug, relating to predicate expressions that do not examine nodes. Please try the following patch, to see if it fixes this bug for you:
--- dbxml-2.3.10-original/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp 2007-04-18 10:05:24.000000000 +0100
+++ dbxml-2.3.10/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp 2007-08-08 11:32:10.000000000 +0100
@@ -1566,11 +1572,12 @@
else if(name == Or::name) {
UnionQP *unionOp = new (&memMgr_) UnionQP(&memMgr_);
+ result.operation = unionOp;
for(VectorOfASTNodes::iterator i = args.begin(); i != args.end(); ++i) {
PathResult ret = generate(*i, ids);
unionOp->addArg(ret.operation);
+ if(ret.operation == 0) result.operation = 0;
- result.operation = unionOp;
// These operators use the presence of the node arguments, not their valueJohn -
is there a way to follow-up on a bug report that i submitted? i have the bug number, but would like to see if the report was understood, filled out properly and determine the status of the bug report.
thanks,
dougThey comment on bugs if actions were taken. Otherwise - don't expect any feedback.
-
Solaris8 and 9 (possibly 7) /dev/poll driver bug report.
Hello,
I'd like to report a bug in the solaris 8 and 9 /dev/poll driver (poll(7d)).
As i do not have a support account with sun or anything like that, there
seems to be no other way to do that here (which is of course a very sad
thing).
Bug details:
The /dev/poll device provides an ioctl-request (DP_ISPOLLED) for checking
if a particular filedescriptor is currently in the set of monitored
filedescriptors for that particular /dev/poll fd set (open /dev/poll fd).
A quote from the documentation of the poll(7d) manual page taken from
Solaris9:
"DP_ISPOLLED ioctl allows you to query if a file descriptor is already in
the monitored set represented by fd. The fd field of the pollfd structure
indicates the file descriptor of interest. The DP_ISPOLLED ioctl returns 1
if the file descriptor is in the set. The events field contains the
currently polled events. The revents field contains 0. The ioctl returns 0
if the file descriptor is not in the set. The pollfd structure pointed by
pfd is not modified. The ioctl returns a -1 if the call fails."
It says that when you query for an filedescriptor which is currently being
monitored in the set, that it would return 1, and change the events field of
the pollfd structure to the events it's currently monitoring that fd for.
The revents field would be set to zero.
However the only thing which actually happens here, is that FD_ISPOLLED
returns 1 when the fd is in the set and 0 if not. When the fd is in the
set, when FD_ISPOLLED returns 1, the events field remains unmodified, but
the revents field gets changed.
A small sample code to illustrate:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/devpoll.h>
main() {
struct pollfd a;
int dp_fd = open("/dev/poll", O_WRONLY);
a.fd = 0; /* stdin */
a.events = POLLIN; /* we monitor for readability, POLLIN=1 */
a.revents = 0;
write(dp_fd, &a, sizeof(a));
a.fd = 0;
a.events = 34; /* filled in with bogus number to show malfunctioning */
a.revents = 0;
printf("DP_ISPOLLED returns: %d\n", ioctl(dp_fd, DP_ISPOLLED, &a));
printf("a.fd=%d, a.events=%hd, a.revents=%hd\n", a.fd, a.events,
a.revents);
According to the documentation of /dev/poll and namely DP_ISPOLLED this
program is supposed to print the following:
DP_ISPOLLED returns: 1
a.fd=0, a.events=1, a.revents=0
However it prints the following:
DP_ISPOLLED returns: 1
a.fd=0, a.events=34, a.revents=1
You can take any number instead of '34' and it will simply remain untouched
after the DP_ISPOLLED ioctl-request.
I hope it's clear now that the solaris8 and solaris9 (and probably solaris7
with /dev/poll patch too) DP_ISPOLLED implementation is broken.
This bug is also easily illustrated by looking at the solaris8 kernel sourcecode:
<snippet osnet_volume/usr/src/uts/common/io/devpoll.c:dpioctl()>
case DP_ISPOLLED:
pollfd_t pollfd;
polldat_t *pdp;
if (pollfd.fd < 0) {
mutex_exit(&pcp->pc_lock);
break;
pdp = pcache_lookup_fd(pcp, pollfd.fd);
if ((pdp != NULL) && (pdp->pd_fd == pollfd.fd) &&
(pdp->pd_fp != NULL)) {
pollfd.revents = pdp->pd_events;
if (copyout(&pollfd, (caddr_t)arg,
sizeof(pollfd_t))) {
mutex_exit(&pcp->pc_lock);
DP_REFRELE(dpep);
return (set_errno(EFAULT));
*rvalp = 1;
</snippet>
its' clearly visible that the code writes the current monitored events to
the revents field:
'pollfd.revents = pdp->pd_events;'
and that it doesnt set revents to zero.
It's funny to see that this has been like this since Solaris8 (possibly 7). That means nobody ever used DP_ISPOLLED that way or people were simply to lazy to file a bug report.
Another funny thing related to this. is that Hewlett-Packard did seem to know about this. Since HP-UX11i version 1.6 they also support /dev/poll. From their manual page i ll quote some sentences from their WARNING session:
"The ioctl(DP_ISPOLLED) system call also returns its result in the revents member of the pollfd structure, in order to be compatible with the implementation of the /dev/poll driver by some other vendors."
Hopefully this will get fixed.
I also like to reexpress my very negative feelings towards the fact that you're not able to file bug reports when you do not have a support contract. Ridiculous.
Thanks,
bighawkHave I mentioned how much i love my playbook now Great job on os 2.0
-
[bdb bug]repeatly open and close db may cause memory leak
my test code is very simple :
char *filename = "xxx.db";
char *dbname = "xxx";
for( ; ;)
DB *dbp;
DB_TXN *txnp;
db_create(&dbp,dbenvp, 0);
dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
if(ret != 0)
printf("failed to open db:%s\n",db_strerror(ret));
return 0;
txnp->commit(txnp, 0);
dbp->close(dbp, DB_NOSYNC);
I try to run my test program for a long time opening and closing db repeatly, then use the PS command and find the RSS is increasing slowly:
ps -va
PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
1986 pts/0 S 0:00 466 588 4999 980 0.3 -bash
2615 pts/0 R 0:01 588 2 5141 2500 0.9 ./test
after a few minutes:
ps -va
PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
1986 pts/0 S 0:00 473 588 4999 976 0.3 -bash
2615 pts/0 R 30:02 689 2 156561 117892 46.2 ./test
I had read bdb's source code before, so i tried to debug it for about a week and found something like a bug:
If open a db with both filename and dbname, bdb will open a db handle for master db and a db handle for subdb,
both of the two handle will get an fileid by a internal api called __dbreg_get_id, however, just the subdb's id will be
return to bdb's log region by calling __dbreg_pop_id. It leads to a id leak if I tried to open and close the db
repeatly, as a result, __dbreg_add_dbentry will call realloc repeatly to enlarge the dbentry area, this seens to be
the reason for RSS increasing.
Is it not a BUG?
sorry for my pool english :)
Edited by: user9222236 on 2010-2-25 下午10:38I have tested my program using Oracle Berkeley DB release 4.8.26 and 4.7.25 in redhat 9.0 (Kernel 2.4.20-8smp on an i686) and AIX Version 5.
The problem is easy to be reproduced by calling the open method of db handle with both filename and dbname being specified and calling the close method.
My program is very simple:
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include "db.h"
int main(int argc, char * argv[])
int ret, count;
DB_ENV *dbenvp;
char * filename = "test.dbf";
char * dbname = "test";
db_env_create(&dbenvp, 0);
dbenvp->open(dbenvp, "/home/bdb/code/test/env",DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL, 0);
for(count = 0 ; count < 10000000 ; count++)
DB *dbp;
DB_TXN *txnp;
db_create(&dbp,dbenvp, 0);
dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
if(ret != 0)
printf("failed to open db:%s\n",db_strerror(ret));
return 0;
txnp->commit(txnp, 0);
dbp->close(dbp, DB_NOSYNC);
dbenvp->close(dbenvp, 0);
return 0;
DB_CONFIG is like below:
set_cachesize 0 20000 0
set_flags db_auto_commit
set_flags db_txn_nosync
set_flags db_log_inmemory
set_lk_detect db_lock_minlocks
Edited by: user9222236 on 2010-2-28 下午5:42
Edited by: user9222236 on 2010-2-28 下午5:45
Maybe you are looking for
-
My iphone 4s will not allow me to open applcations that I have downloaded. I have tried a few things but still will not allow me to open. Shows they are open once pushing the home button twice. Please help!
-
To get two computers to talk via BlueTooth
To get both my computers to talk to each other. Is there a way via BlueTooth or is the only way via Ethernet. I can get it to work with ethernet, but I can not with BlueTooth, BlueTooth only transfers files or what ever. It can not see the other HD l
-
Imported the PO/SO/AR/AP/GL
Can anyone please let me know how to import the PO/SO/AR/AP/GL from Quick Book to SAP B1? We try to see if we can do those on ourselve or we have to pay more for our consulting firm to do it. Thank you so much.
-
What to do if non of the spoken Responses for VoiceRecognition are in the list?
like listen for ("yes", "no") but the user says another thing. And you want the program to continue, you don't want to exit with an error. And also is SpeechReconitionServer still part of Mavericks? i haven't used Applescript in a while and i'm getti
-
Dynamic names for Datagrid column headers?
How can I put data from my ws into the headerText for a DataGrid? I was hoping to find a defined property something like "HeaderTextFunction" built into the DataGrid but I didn't see anything like that. Do you have to use the Advanced DataGrid for so