Select() does not block

I cannot provide simple code for this yet. Nondeterministically,
my calls to Selector.select() do not block. That is, they return
immediately, and they return 0. There are no calls to
Selector.wakeup() in the program, and I check that
isInterrupted() == false from the thread that invokes select().
The Javadoc states that these are the only two circumstances in
which a return of 0 from select() should be possible.
When this starts happening, it happens consistently ad infinitum,
but it doesn't start happening in every execution.
This happens with JDK 1.4.1-RC but NOT in JDK 1.4.0. I cannot
easily roll back to JDK 1.4.0 because the OP_WRITE select()
behavior has changed, and what I distribute must work with later
versions of the JDK.
I realize that, without a simple test case, it will be hard for anyone
in this forum to diagnose this. I am hoping that, nevertheless,
someone has some good speculation.
I must say, I wish I had coded this in C++. This NIO seems to be
rather shoddy so far.
Thanks in advance,
Juan Leon

What platform are you using? I took a look and quickly found myself looking at a native method call in a platform-specific class. (sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(), specifically.) The provider (SelectorProvider.provider().getClass().getName()) might be helpful in diagnosing this. On my system (JDK 1.4.1_01, Win XP) it is: sun.nio.ch.WindowsSelectorProvider.
With a little help from Jad and some hand editing of the formal arguments to poll0(), I get:
private int poll() throws IOException {
    return poll0(pollWrapper.pollArrayAddress,
        Math.min(totalChannels, 1024), readFds, writeFds, exceptFds, timeout);
private native int poll0(long address, int channels,
    int[] readFds, int[] writeFds, int[] exceptFds, long timeout);selectNow() pretty much just calls doSelect(0L) in a synchronized block, so I think hoping it will reset things is futile.
WindowsSelectImpl.doSelect(long) looks like this:
    protected int doSelect(long l) throws IOException {
        if (channelArray == null)
            throw new ClosedSelectorException();
        timeout = l;
        processDeregisterQueue();
        if (interruptTriggered) {
            resetWakeupSocket();
            return 0;
        adjustThreadsCount();
        finishLock.reset();
        startLock.startThreads();
        try {
            begin();
            try {
                subSelector.poll();
            } catch (IOException ioexception) {
                finishLock.setException(ioexception);
            if (threads.size() > 0)
                finishLock.waitForHelperThreads();
        } finally {
            end();
        resetWakeupSocket();
        finishLock.checkForException();
        processDeregisterQueue();
        return updateSelectedKeys();
    }As you can see, when all is said and done it calls the native method mentioned above to do all the work, which most likely calls your system's poll() (or possibly select()?), which may be where your problem actually lies. Another poster suggested it may choke on certain channels (closed w/ half-open socket) -- is it possible for you to remove them from the set before calling select? (I know you shouldn't have to, but....)
By the way, updateSelectedKeys() iterates over the helper threads calling the subclass's processSelectedKeys() method, which in turn calls processFdSet() three times: once each for the readFds, writeFds, and exceptFds. This is what actually computes the return value, and the problem could be here, but isn't likely to be, since you say it isn't even blocking.
Anyway, I've gone on long enough, and I'm sure you can use Jad (or some other decompiler) as well as I can. I'm certainly no nio expert (in fact, I haven't used Selector), and this is only what I found after a quick glance into the code.
Whoa! While proofreading this, that "if (interruptTriggered)" block suddenly jumped out at me. If interruptTriggered is getting stuck on that could cause your problem. It's private volatile boolean and is false initially, then set in wakeup() and reset in resetWakeupSocket().
Jad (v1.5.8e2) coughed while decompiling resetWakeupSocket(), but I think it's:
    private void resetWakeupSocket() {
        synchronized (interruptLock) {
            if (!interruptTriggered)
                return;
        resetWakeupSocket0(wakeupSourceFd);
        interruptTriggered = false;
    }resetWakeupSocket0() is another native method. You'll get some insight into your problem from studying WindowsSelectorImpl (or whatever the implementation is on your platform), but you're going to find that you need to look at the several native methods being called to really determine what's going on.
Good luck,
David R. Conrad

Similar Messages

  • I have F.F 3.6 and windows 7.: 1) When i want to buy a airplane ticket and want to select 2 adults or 2 children, the draw down select, does not work in any websides,? WHY?. 2) Have FF any problems with SKYPE

    I have F.F 3.6 and windows 7.: 1) When i want to buy a airplane ticket and want to select 2 adults or 2 children, the draw down select, does not work in any websides,? WHY?. 2) Have FF any problems with SKYPE
    == This happened ==
    Not sure how often
    == After innstalling windows 7

    As a suggestion I'd put the Text_io segments into their own begin - exception - end sub-blocks within the main code. This way if Text_io does raise an exception you can catch it earlier as it may be able to recover - That is if it is a text_io exception.
    Other than that you;ll have to step through in Debug.

  • WRT54G v8 firmware that does not block ports?

    Hello everyone! Is there a 3rd party firmware for the WRT54G v8 router that does not block ports or has the option to disable port blocking? I would like all ports to be open on all devices in my network. Thank you!

    This setting is not recommended because it opens your entire network to attack.  Instead, you should selectively open only the ports you need to play your Internet games.
    People who open all their ports often get their computers infected with viruses which send out spam.  When your ISP sees you sending spam, they will turn off your email, IM, or even disconnect you.

  • Eclipse problem selection does not contain main type

    i m using eclipse3.3 and have set all the necessary paths in it
    but when i run a simple java program just for displaying hello world but
    the error comes
    selection does not contain main type

    You must have a class with a main method.
    The main method must be public, must be static, must return void, must have parameter String [], and is case sensitive (so does Java).
    Put this into your class
    public static void main(String args[]) {
    }Let me know if it answers your question.
    Best regards.

  • Selection does not contain characteristic combination

    Hi Gurus,
    I am very new to Planning module. When i have created planning sequence on Aggregation level for 0INM_RC02 Cube, system gives error message "Selection does not contain characteristic combination". Can any one help me what is this error msg and how to rectify this one.
    With Regards,
    Balachander.S

    Hi,
    you are trying to post the values which are not in combination for characteristic and its attributes.
    For example :
    Buisness Area, currency.
    India  - INR
    LV10 - GBP
    Now you are trying to post India - GBP,which is invalid.Check in the selection if you are deriving any characteristic on the basis of master data for which you are trying to post invalid entries.
    Or
    You are using characteristic relatioship for which entries are invalid.
    or
    You are trying to post the data which is not restricted in filter for example :-
    If you have restricted currency as INR in filter and trying to post to GBP then you will get this error.
    Regards,
    Indu

  • Error msg, "Maximum selection does not contain value 9999999999.

    Hi, I am getting this error wile doing Reclassification of HFM Movement.
    Error msg, "Maximum selection does not contain value 9999999999 of subassignment HFM CD2 & Asset Type "                                         
    in the Data Monitor, ( in Reclass Net Reserve). While running BCF task for a company for period 16/2009     
    Actually, We have converted the consolidation area from XX(2009) to YY(2010).
    Before this task, user has performed the balance carry forward.
    My Analysis is as follows:-
    Method Used in this Reclassification                                         
    RECYX (Reclassify HFM Movement at YE lvl 10)                                        
         TRIGGER                                   
         Items : 100-299, 9900-9999                                   
         HFM Movement Type : O200 to O300                                   
         Posting Level : 10                                   
         TARGET                                   
         Items : 100-299, 9900-9999                                   
         Move : O100C                                   
         Posting Level : 10                                   
         HFM CD2 and Asset type : Ticked                                    
    After TEST run in UCMON, the error message comes :-                                        
    The "HFM CD2 & Asset Type value 9999999999" is not maintained in Breakdown Categories Y500, Y700  etc.                                        
    Breakdown categories in Workbench                                        
    Maintained as "OPTIONAL, Initialized value allowed".                                        
    Single Selection                                         
    1A                                        
    1B                                        
    AR                                        
    GA                                        
    Default Selection                                        
    99999999999                                        
    BCS CUBE                                         
    HFM CD2 & Asset Type - coming blank               
    LOTR                                        
    HFM CD2 & Asset Type - Coming blank     
    Please help to go forward.
    In Anticipation,
    Deepankar Jain

    Thanks a lot Dan for the reply.
    Yes, the single selection is 1A, 1B etc, I agree that including this default value 9999999999 in single selection will resolve this issue, but the BREAK DOWN TYPE is OPTIONAL, that means It will also consider a blank value, right?
    Also, In the method defined for RECLASSIFICATION in workbench, in the TARGET parameters, the" HFM CD2 and Asset Type"  is blank but the "DEFAULT is TICKED" which makes it a mandatory derivation rule.
    Please correct me if I am wrong.
    Your replies on it are highly appreciated.
    Thanks and Regards,
    Deepankar

  • Eclipse "selection does not contain main type" - but it does contain a main

    Hi!
    I'm having a strange thing happen to me when using the eclipse IDE in a macintosh envirnment.
    I imported a project, complete with package, and all of my classes. and when I try to run my main class, it tells me "selection does not contain main type".
    Which is entirely untrue, the class I am trying to run contains a public static void main(), does anyone know what's going on here?

    the class is quite large, I don't think that it is a problem with the class, because it runs fine on my windows based pc (also in eclipse)...

  • Selection does not contain main type

    Hi All,
    I am getting the Launch error saying:
    "Selection does not contain main type" while running the program in eclipse.
    Is there any common aspects from where it is being generated?
    Thanks in advance
    regards

    lkarmacharya wrote:
    eclipse launch error: "editor doesn't contain a main type"Hi,
    Please don't resurrect old threads, and this isn't an eclipse forum. I'm locking this thread. Create a new one if you have a specific Java programming related problem.
    Kaj

  • [Eclipse Problem] Selection does not contain a main type?

    well i am using a GUI builder software which generates java code, i made a simple one to test and it will not compile.
    import java.awt.*;
    import javax.swing.*;
    public class name  {
         @SuppressWarnings("unused")
         private void initComponents() {
              panel1 = new JPanel();
              label1 = new JLabel();
              textField1 = new JTextField();
              panel1.setLayout(new FlowLayout());
              label1.setText("Name:");
              label1.setHorizontalAlignment(SwingConstants.LEFT);
              panel1.add(label1);
              textField1.setColumns(12);
              textField1.setText("hi");
              panel1.add(textField1);
         private JPanel panel1;
         private JLabel label1;
         private JTextField textField1;
    }it should make a basic swing GUI but it just gives me the error "Selection does not contain a main type"
    I did not select in eclipse "use public static void main" i know im not supposed to because this has no main method, but how am i to compile this? =X
    Edited by: -Johnny- on May 14, 2008 6:44 PM
    Edited by: -Johnny- on May 14, 2008 6:44 PM

    -Johnny- wrote:
    ya i used javac instead of eclipse then running it complains like you say
    but is there any way to compile this code and it will work? I was hoping to use this GUI builder for business purposes but it seems like a waste of money so far if i can't make working java application with it =\The code is fine. You need to learn the basics. Start with the intro tutorials at the Sun type and start reading and coding.
    Here is what the rest could look like:
    import java.awt.*;
    import javax.swing.*;
    public class name
        @SuppressWarnings("unused")
        private void initComponents()
            panel1 = new JPanel();
            label1 = new JLabel();
            textField1 = new JTextField();
            panel1.setLayout(new FlowLayout());
            label1.setText("Name:");
            label1.setHorizontalAlignment(SwingConstants.LEFT);
            panel1.add(label1);
            textField1.setColumns(12);
            textField1.setText("hi");
            panel1.add(textField1);
        private JPanel panel1;
        private JLabel label1;
        private JTextField textField1;
        public name()
            initComponents();
        public JPanel getPanel()
            return panel1;
        private static void createAndShowUI()
            JFrame frame = new JFrame("name");
            frame.getContentPane().add(new name().getPanel());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    }Edited by: Encephalopathic on May 14, 2008 7:10 PM

  • Maximum selection does not contain value 600 of subassignment Subitem-error

    Hi All,
    I'm getting the following error when i tried to load the file through data stream.
    Maximum selection does not contain value 600 of subassignment Subitem
    Message no. UCD1038
    Diagnosis
    The posting item 11100100 has breakdown category BR01 for which a maximum selection was maintained for subassignment Subitem. The current posting value, however, is not in this maximum selection.
    System Response
    The posting is not possible.
    Procedure
    Check the maximum selection and the posting.
    I have already refered the earlier threads but its of no use for me. I have checked my setting w.r.t to FS item breakdown category, Max selection in breakdown category and  sub items all the setting are fine, even i applied the OSS notes no-1074599 still i'm facing the same issue.
    Can any one help me with this regards, thanks in advance.
    Regards,
    Magesh

    Hi Dan,
    Yes, breakdown category has been assigned with a sub item category which in turn assigned to subitems and this sub item is a part of the sub item category which is assigned in max. selection.
    Let me know if you want any more information on the same.
    Regards,
    Magesh

  • Ps CC 2014 is not working correctly after mac update to Yosemite 10.10.1.  Select does not protect unselected areas.  Magic eraser erases unselected ares.

    Ps CC 2014 is not working correctly after mac update to Yosemite 10.10.1.  Select does not protect unselected areas.  Magic eraser erases unselected ares.

    Yes my particular issue is not like yours. However, there have been many other laptop users experiencing similar problem to yours after 3.10 kernel. Mostly it seems to be bumblebee users that experience your problem with the blank screen. We do know that nvidia have yet to make their official drivers work with kernel 3.10 and up. The drivers in the Arch repository have been patched to work with 3.10. From what I have seen, this also only seem to be affecting laptops with newer nvidia gpu's. I fear there is not much to do with this problem until nvidia give official 3.10 kernel support.
    My suggestion would be to stick with 3.9.9 kernel and the drivers that work with it, and don't upgrade those packages until nvidia has addressed these issues. If you have a look at the nvidia forums you will see quite a number of topics mentioning black screen when starting x on 3.10 kernel, and also a thread for the system dying. Reading some of the threads there may help you keep up to date on whether or not the issue seem to be solved.
    https://devtalk.nvidia.com/default/board/98/

  • Even with pass word edit, it won't offer up that pass word for a site that does not block PW's.

    I listen to whisperings at solopianoradio.com. This site does not block a log in. I use the app add on to edit pass words and entered this web site and pass word. Firefox will still not act on this entered pass word.

    Don't follow what you are saying. Earlier versions of Firefox remembered and placed pass words for solopiano. When Firefox was updated to the latest ver, Firefox stopped placing pass words for solopiano. I reloaded 3.6.18, but it still does not work. I checked with the site operator. He does not know why I have the problem as no one else has reported this problem.

  • Blocksite does not block a bookmarked site

    I installed Blocksite to use it to block Facebook on my home computer. It works if I type in the URL in the text box. But, if I click on the bookmark on the toolbar for Facebook that was saved before I downloaded Blocksite, it does not block Facebook. Any suggestions?

    [http://support.mozilla.org/en-US/kb/Firefox%20cannot%20load%20websites%20but%20other%20programs%20can#w_firefox-cannot-load-certain-websites Firefox cannot load certain websites]
    thank you

  • WRT1900AC does not block internet access in Parental Control

    Hi,My router does not block internet access on my other PC. I tryed "Always" tryed specific addresses, tryed IP addresses and everything tech support suggested. I even replaced the router at their advise. Nothing helped. I realize that the problem is not the router but probably my home network configuration, but I can't figure out what is it. To my defence, so couldn't they Does anybody have or had such a problem?Thank you

    What Firmware version is currently loaded?Can you post screen shots of how you have the controls configured?Does the User Manual give any configuration help?  Internet Service Provider and Modem Configurations  
     What ISP Service do you have? Cable or DSL?
     What ISP Modem Mfr. and model # do you have?  Router and Wired Configurations  
      Setup DHCP reserved IP addresses for all devices ON the router. This ensures each devices gets its own IP address when turned on and connected, eliminates IP address conflicts and helps in troubleshooting and maintain consistency for applications that need to connect as well as mapped drives. 

  • Why DDL during SELECT is possible. Or why SELECT does not put a table lock?

    This is a question to people who really knows Oracle internals or/and RDB theory.
    (The question is relocated from another thread for not hijacking on that's original question.)
    Why DDL during SELECT is possible? Or why SELECT does not put TM 2 Row Shared lock on table(s)?
    This not locking causes a possibility while one session is running a long select, another can truncate and even drop table(s) that are being read by the first session.
    I think, humbly assume, that Oracle does not put TM 2 lock on tables, that are being simply SELECTed, by some significant technical reason. But I do not know this reason. If somebody knows please shed a light.
    Also, if you know that this behavior is totally correct from perspective of RDB theory, please explain me.
    I'll try to explain my point.
    It is a matter of data consistency and integrity that is supported in Oracle everywhere except this place.
    a) If one session is reading data from moment T and other session changes data on its way at moment T1, the first session wont read that changed data, it will read the data that was there on moment T.
    This is declared as Read Consistency principle.
    b) If one session is changing data, and another session tries to truncate or drop table - the second session will fail with error ORA-00054: resource busy and acquire with NOWAIT specified.
    This is declared as Data Integrity principle.
    c) But why not to follow the above principles in case when one session reads data and another session tries to truncate or drop table (or do other DDL operations)?
    It is counter-intuitive. Why not to put TM 2 (SS) lock during SELECT execution that would prevent DDLs on this table?
    What I only can assume is that this is only because some technical difficulty or limitation.
    What is this limitation or other reason in favor of which Oracle sacrificed consistency in this case?

    user11181920 wrote:
    Aman,
    There was no need to clarify how DML lock works, I know that.
    Also I know that in Oracle a Select does not lock neither table rows nor table itself.
    The reason I mentioned it because you brought up the word change which is far better suited for DML's than DDL's as the former has a requirement to have its Undo preserved.
    Again, my question was why Select does not protect itself by locking table(s), partitions and indexes?Protect from what? There is nothing wrong with doing a select. What would happen with a select doing a lock on the table before being executed in its entirety (forget DDL and DML altogether for a moment) ? State one good reason that there should be a lock for the select. If it has to, it would be always isn't it?
    The keyword here is concurrency and that's what is the best when the number of locks obtained are lesser at non-required operations. A select doesn't change anything that's why in Oracle, there is no read-level lock.I am not saying about row locks while reading. They are not needed because Undo resolves concurrency.Only in the case of DML where the change is still active and the buffers are dirty. With a DDL, its an implicit commit.
    I am asking why Select does not enqueue one, only one lock per object that participates in the Select?Again, my question back to you is, what good you would get from it? What purpose it would solve?
    It is not very expensive, I suppose. But it would protect from DDLs that can destroy the Select's result set. You have seen in your system and in my demo(and that's what the the question was on the other thread also) that the result remains intact and its not a behavior from now. Its the same since the time I have started learning Oracle. Can you explain that why you think that the result of select statement would be wrong for a drop table? I believe, its been stated repeatedly that if the select has no requirement to look back the table, it would get completed. Only if the select needs to access the table again, it would fail. So even if we consider your explanation, there is no wrong result shown at all. Once the session encounters that the table is dropped for the statement, the execution stops right away. So where is the destroyed result?
    Yes, it is less dangerous when Select does not lock table comparing with what would happen with DMLs in such case (that is why DMLs protect themselves by TM 3), it affects only the Select and its consumer, but still ... I don't understand this Oracle's decision. What is a reasoning behind it?.As I said, to improve concurrency.
    Aman....

Maybe you are looking for

  • I cannot seem to purchase from I tunes something is wrong when buying songs?

    I tunes will not allow me to download music from the store, the buy button is not working why ?

  • Old versions of flash installed with Photoshop

    It is not clear to me if this is the correct place to post this question, but I hope this is a better place than in the forum on flash in web browsers.  If anyone can suggest a better place to post this, please let me know. I have kept the copy of fl

  • Propose Measuring point automatically in IW42

    Hi, I have assigned a measuring point as PRT to the operation of an Order. During confirmation in IW42, after entering the order number system proposes the operation details and I need to click button meas.points Inspn planning to display the measuri

  • Keynote 6.0 build order has its own window. WHY?!

    Does anyone agree with me that this is really insane? Why can't builds integrate in the new right-hand-side panel? Instead, they're forever going to be either in the way of something else, or I've got to make the window narrower and hang it off the s

  • Code tags

    This is my first forum. How do you use the 'code tags' on this site? Should i click the code button then paste my code? Should I paste my code in between "like right here"?