I mentioned that I got into some problems with MSMQ that I couldn’t reproduce later on. Well, here is the actual code that I am running that is causing a hung. As you can see, this is really strange.
BeginPeek() Initiates an asynchronous peek operation that has no time-out. The operation is not complete until a message becomes available in the queue.
So when there are no messages, the peek would never complete. What am I missing?
It's not good practice to reuse an object after it's disposed, right? I'm sure examples like this exist all over the BCL; especially cases where one is using BeginXXX after disposal.
I also had weird problems with MSMQ, but the problems only happened when I was using the async functions/events. I found them to be pretty unreliable - especially when failures occured. Things would just stop working - no reason, no exception, the thread would simply die. It was so inconsistent, that I ended up just polling on my own threads.
Comment preview
Comments have been closed on this topic.
Markdown formatting
ESC to close
Markdown turns plain text formatting into fancy HTML formatting.
Phrase Emphasis
*italic* **bold**
_italic_ __bold__
Links
Inline:
An [example](http://url.com/ "Title")
Reference-style labels (titles are optional):
An [example][id]. Then, anywhere
else in the doc, define the link:
[id]: http://example.com/ "Title"
> Email-style angle brackets
> are used for blockquotes.
> > And, they can be nested.
> #### Headers in blockquotes
>
> * You can quote a list.
> * Etc.
Horizontal Rules
Three or more dashes or asterisks:
---
* * *
- - - -
Manual Line Breaks
End a line with two or more spaces:
Roses are red,
Violets are blue.
Fenced Code Blocks
Code blocks delimited by 3 or more backticks or tildas:
```
This is a preformatted
code block
```
Header IDs
Set the id of headings with {#<id>} at end of heading line:
## My Heading {#myheading}
Tables
Fruit |Color
---------|----------
Apples |Red
Pears |Green
Bananas |Yellow
Definition Lists
Term 1
: Definition 1
Term 2
: Definition 2
Footnotes
Body text with a footnote [^1]
[^1]: Footnote text here
Abbreviations
MDD <- will have title
*[MDD]: MarkdownDeep
FUTURE POSTS
Partial writes, IO_Uring and safety - about one day from now
Configuration values & Escape hatches - 4 days from now
What happens when a sparse file allocation fails? - 6 days from now
NTFS has an emergency stash of disk space - 8 days from now
Challenge: Giving file system developer ulcer - 11 days from now
And 4 more posts are pending...
There are posts all the way to Feb 17, 2025
RECENT SERIES
Challenge
(77): 20 Jan 2025 - What does this code do?
Answer
(13): 22 Jan 2025 - What does this code do?
Comments
With identical code I get
test_queue2
CompletedSynchronously: False
IsCompleted: False
Wait completed : False
test_queue
CompletedSynchronously: False
IsCompleted: False
Wait completed : False
sorry, missed to the comment about "messages in queue2". Too late... Same result as you.
Erm, according to MSDN,
BeginPeek() Initiates an asynchronous peek operation that has no time-out. The operation is not complete until a message becomes available in the queue.
So when there are no messages, the peek would never complete. What am I missing?
The queue.Dispose()
It's not good practice to reuse an object after it's disposed, right? I'm sure examples like this exist all over the BCL; especially cases where one is using BeginXXX after disposal.
I also had weird problems with MSMQ, but the problems only happened when I was using the async functions/events. I found them to be pretty unreliable - especially when failures occured. Things would just stop working - no reason, no exception, the thread would simply die. It was so inconsistent, that I ended up just polling on my own threads.
Comment preview